Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


Search the Community

Showing results for tags 'LUA'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • FIBARO Community
    • FIBARO Portal and Forum policy
    • FIBARO
    • Say hello!
    • Off-topics
  • FIBARO Update
    • FIBARO System Update
    • FIBARO Mobile Update
  • FIBARO Community Support
    • Scenes and Interface
    • FIBARO Products
    • FIBARO Mobile
    • FIBARO HomeKit
    • FIBARO Assistant Integrations
    • Other Devices / Third-party devices
    • Tutorials and Guides
    • Home Automation
    • Suggestions
  • FIBARO Społeczność
    • FIBARO
    • Przywitaj się!
    • Off-topic
  • FIBARO Aktualizacja
    • FIBARO System Aktualizacja
    • FIBARO Mobile Aktualizacja
  • FIBARO Wsparcie Społeczności
    • Sceny i Interfejs
    • FIBARO Urządzenia
    • FIBARO Mobilnie
    • FIBARO HomeKit
    • Integracja z Amazon Alexa i Google Home
    • Urządzenia Firm Trzecich
    • Poradniki
    • Automatyka Domowa
    • Sugestie

Categories

  • Scenes
  • Virtual Devices
  • Quick Apps
  • Icons

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Facebook


Google+


Skype


Website URL


WhatsApp


Country


Gateway/s


Interests

  1. Witam, Scena LUA utworzona ze sceny blokowej mi nie działa. Tak w danym moncie aktywna jest tylko jedna z dwóch scen. Scena blokowa: Utworzona z niej scena LUA: Ktoś ma pojęcie o co chodzi?
  2. Fetch data from wunderground.com, send morning and afternoon forecast to your smartphone using Fibaro app, Telegram or Pushover. Data from wunderground.com can be from a PersonalWeatherStation(PWS) or nearest LocationID(LOCID) Example of forecast and pushoptions to use. 1'st value is smartphoneID, 2'nd value is morning forecast, 3'rd is afternoon forecast, 4'th is pushoption smartphoneID_and_fcst ={{281, "06:30", "17:00", "Telegram"},{320, "08:00", "17:00", "Pushover"},{32, "08:00", "17:00", "Fibaro"}} Sending as Pushover message requires an own scene that monitors Pushover variable, read about it here: http://forum.fibaro.com/index.php?/topic/17422-tutorial-pushover-lua-vd-global-function/#entry55857 All important keys like API keys, tokens etc will be saved to variable panel. Supports many languages (EN, FR, SW, PL, NL, DE, NO, RO, CZ, GR, PT, RU (default is en)) Complete lua code (save in a new scene) --[[ %% autostart %% properties %% globals --]] ------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------- -- HOWTO -- -- 1. Create a virtual device with 9 labels and set the ID to like below, else this scene will not work. -- 2. lblTemp, lblHum, lblBar, lblWind, lblRain, lblFcst, lblStation, lblUpdate, lblNotify -- 3. Change ID of virtual device in WU.selfId -- FIRST TIME USERS NEEDS TO COPY ALL CODE TO SCENE, after version 2.5.0 it should only be neccessary to update from "UPDATE FROM HERE" text -- NOTE -- -- Scheduled time you set for forecast push is just an indication of time. -- Real time will be the hour you set + minute of when scene starts. -- Script will check server version for new updated version (default = true) -- WU WeatherData - Fetch weather data from wunderground.com. Multilanguage support! -- Inspired by GEA(steven), stevenvd, Krikroff and many other users. -- Source - forum.fibaro.com, domotique-fibaro.fr and worldwideweb -- Special thanks to petergebruers from forum.fibaro.com with demo script -- -- -- PWS = Personal Weather Station -- LOCID = Public station -- -- -- 2014-03-22 - Permissions granted from Krikroff -- 2014-03-23 - Added rain and forecast, Added FR language. -- 2014-03-23 - Language variable changed to get the translation from wunderground.com in forcast -- 2014-03-24 - Added PL language -- 2014-03-24 - Select between PWS or LOCID to download weather data -- 2015-10-23 - New source code. -- 2015-10-23 - Added NL translation -- 2015-11-16 - Added DE, FR translation. Fixed some bug in the code(hardcoded smartphoneID,inch to metric for rain value) -- 2015-11-18 - Script moved to scene instead of mainloop in VD. VD is only used as GUI. -- 2015-11-18 - Send push if script cannot fetch data -- 2015-11-26 - adjustment of code. Function from sebcbien at domotique-fibaro.fr -- 2015-11-27 - Oops! Removed forecast push by mistace. -- 2016-02-11 - send push if new version of script is out -- 2016-03-31 - Added NO translation, did cleanup the code a little bit. -- 2016-03-31 - It is now posible to use Telegram as push. Change WU.pushOption value to Telegram or Fibaro. -- - also change WU.Telegramtoken and WU.Telegramchat_id to your values -- 2016-04-01 - Fixed bug when using Telegram push, forecast must send with lowercases. -- 2016-05-26 - Added support for multiple smartphone id when sending push -- 2016-05-30 - Implemented "UPDATE SECTION" -- 2016-07-13 - Bug fixed some code for sendPush to fibaro app -- 2016-07-14 - Telegram, possible to have forecast pushed to 2 different chat_id's -- 2016-07-15 - Save all importent values to variable. -- 2016-07-15 - Added RO, GR, PT, RU and CZ translation -- 2016-07-16 - Possible to have different time for push to all smartphones -- 2016.07-17 - Bugfixes. Changed layout of JSON table for smartphoneID, time and push option -- 2016-07-18 - Bugfixes and better error reporting. Supports Pushover (works together with -- 2016-07-19 - Bugfixes again. -- 2016-07-22 - Added seconde forcast to both morning and afternoon push message. Added parse_mode for bold telegram text message -- 2016-07-24 - Added ES (Spanish) translation -- 2016-08-03 - Bugfixes (in WU.dualChat_ID part of code) WU = {} versionCheck = true -- check if new version of script exist on server WU.language = "SW"; -- EN, FR, SW, PL, NL, DE, NO, RO, CZ, GR, PT, RU, ES (default is en) ---- UPDATE FROM HERE ---- -- WU settings if not fibaro:getGlobal("WUAPI") == nil then WU.APIkey = fibaro:getGlobal("WUAPI") else -- [CHANGE THIS IF VALUES ARE NOT STORED IN VARIABLE PANEL] WU.APIkey = "14eaffxxxxxxxxxxxxxx" --Put your WU api key here end WU.PWS = "IGVLEBOR5" -- The PWS location to get data for (Personal Weather Station) WU.LOCID = "SWXX0076" -- The location ID to get data for (City location) WU.station = "PWS" -- PWS or LOCID ---- UPDATE FROM HERE ---- version = "{V3.0.5}" -- Other settings smartphoneID_and_fcst ={{281, "06:30", "21:10", "Telegram"},{32, "08:00", "16:00", "Fibaro"}} -- ID, time for morning and afternoon forecast and what push to use WU.sendPush = true -- send forecast with push -- Telegram settings -- IMPORTANT -- -- Telegramtoken needs to splitted into 2 parts. First part1 is before the ":", part2 is after the ":" if not fibaro:getGlobal("Telegramtoken1_part1") == nil then WU.Telegramtoken1_part1 = fibaro:getGlobal("Telegramtoken1_part1") else -- [CHANGE THIS IF VALUES ARE NOT STORED IN VARIABLE PANEL] Telegramtoken needs to splitted into 2 parts. First part1 is before the ":", part2 is after the ":" WU.Telegramtoken1_part1 = "187xxxxxx" -- ******** end if not fibaro:getGlobal("Telegramtoken1_part2") == nil then WU.Telegramtoken1_part2 = fibaro:getGlobal("Telegramtoken1_part2") else -- [CHANGE THIS IF VALUES ARE NOT STORED IN VARIABLE PANEL]Telegramtoken needs to splitted into 2 parts. First part1 is before the ":", part2 is after the ":" WU.Telegramtoken1_part2 = "AAHfzhTcsKloviNxxxxxxxxxxxxxxxxx" -- ******** end if not fibaro:getGlobal("Telegramchat_id1") == nil then WU.Telegramchat_id1 = fibaro:getGlobal("Telegramchat_id1") else -- [CHANGE THIS IF VALUES ARE NOT STORED IN VARIABLE PANEL] Telegramtoken chat_id 1 WU.Telegramchat_id1 = "2025xxxxx" -- ******** end -- If you want forecast to be pushed to a second phone WU.dualChat_ID = false -- set to true if more then 1 smartphone that should have forecast pushed. if not fibaro:getGlobal("Telegramtoken2_part1") == nil then WU.Telegramtoken2_part1 = fibaro:getGlobal("Telegramtoken2_part1") else -- [CHANGE THIS IF VALUES ARE NOT STORED IN VARIABLE PANEL] Telegramtoken needs to splitted into 2 parts. First part1 is before the ":", part2 is after the ":" WU.Telegramtoken2_part1 = "187xxxxxx" end if not fibaro:getGlobal("Telegramtoken2_part2") == nil then WU.Telegramtoken2_part2 = fibaro:getGlobal("Telegramtoken2_part2") else -- [CHANGE THIS IF VALUES ARE NOT STORED IN VARIABLE PANEL] Telegramtoken needs to splitted into 2 parts. First part1 is before the ":", part2 is after the ":" WU.Telegramtoken2_part2 = "AAHfzhTcsKloviNxxxxxxxxxxxxxxxxx" -- ******** end if not fibaro:getGlobal("Telegramchat_id2") == nil then WU.Telegramchat_id2 = fibaro:getGlobal("Telegramchat_id2") else -- [CHANGE THIS IF VALUES ARE NOT STORED IN VARIABLE PANEL]Telegramtoken chat_id 2 WU.Telegramchat_id2 = "2025xxxxx" -- ******** end updateEvery = 5 -- get data every xx minutes WU.selfId = 150 -- ID of virtual device WU.translation = {true} WU.currentDate = os.date("*t"); DoNotRecheckBefore = os.time() WU.scheduler = os.time()+60*updateEvery WU.translation["EN"] = { Exiting_loop_push = "Exiting_loop_push", Push_forecast = "Push forecast", Temperature = "Temperature", Humidity = "Humidity", Pressure = "Pressure", Wind = "Wind", Rain = "Rain", Forecast = "Forecast", Station = "Station", Fetched = "Fetched", Data_processed = "Data processed", Update_interval = "Next update will be in (min)", No_data_fetched = "No data fetched", new_version = "New version of WUWeather.lua script is out! ", script_url = "http://jonnylarsson.se/JL/", NO_STATIONID_FOUND = "No stationID found", NO_DATA_FOUND = "No data found" } WU.translation["FR"] = { Exiting_loop_push = "Exiting_loop_push", Push_forecast = "Push prévisions", Temperature = "Température", Humidity = "Humidité", Pressure = "Pression", Wind = "Vent", Rain = "Pluie", Forecast = "Prévisions", Station = "Station", Fetched = "Reçu", Data_processed = "Données Analysées", Update_interval = "Prochaine update prévue dans (min)", No_data_fetched = "Pas de données reçues", new_version = "New version of WUWeather.lua script is out! ", script_url = "http://jonnylarsson.se/JL/", NO_STATIONID_FOUND = "StationID non trouvée", NO_DATA_FOUND = "Pas de données disponibles" } WU.translation["SW"] = { Exiting_loop_push = "Push loop avslutad", Push_forecast = "Push forecast", Temperature = "Temperatur", Humidity = "Fuktighet", Pressure = "Barometer", Wind = "Vind", Rain = "Regn", Forecast = "Prognos", Station = "Station", Fetched = "Hämtat", Data_processed = "All data processat", new_version = "New version of WUWeather.lua script is out! ", script_url = "http://jonnylarsson.se/JL/", Update_interval = "Nästa uppdatering är om (min)", No_data_fetched = "Inget data hämtat", NO_STATIONID_FOUND = "StationID ej funnet", NO_DATA_FOUND = "Ingen data hos WU" } WU.translation["PL"] = { Exiting_loop_push = "Kończę pętlę PUSH", Push_forecast = "PUSH prognozy", Temperature = "Temperatura", Humidity = "Wilgotność", Pressure = "Ciśnienie", Wind = "Wiatr", Rain = "Deszcz", Forecast = "Prognoza", Station = "Stacja", Fetched = "Nie pobrano danych", Data_processed = "Dane przetworzone", new_version = "Dostępna nowa wersja skryptu WUWeather.lua ! ", script_url = "http://jonnylarsson.se/JL/", No_data_fetched = "Brak danych", Update_interval = "Następna aktualizacja za (min)", NO_STATIONID_FOUND = "Nie znaleziono ID Stacji", NO_DATA_FOUND = "Brak danych" } WU.translation["NL"] = { Exiting_loop_push = "Exiting_loop_push", Push_forecast = "Push verwachting", Temperature = "Temperatuur", Humidity = "Vochtigheid", Pressure = "Druk", Wind = "Wind", Rain = "Regen", Forecast = "Verwachting", Station = "Weerstation", Fetched = "Ontvangen", Data_processed = "Gegevens verwerkt", new_version = "New version of WUWeather.lua script is out! ", script_url = "http://jonnylarsson.se/JL/", Update_interval = "Volgende update in (min)", No_data_fetched = "Geen gegevens ontvangen", NO_STATIONID_FOUND = "Geen stationID gevonden", NO_DATA_FOUND = "Geen gegevens gevonden" } WU.translation["DE"] = { Exiting_loop_push = "Exiting_loop_push", Push_forecast = "Push vorhersage", Temperature = "Temperatur", Humidity = "Luftfeuchtigkeit", Pressure = "Luftdruck", Wind = "Wind", Rain = "Regen", Forecast = "Vorhersage", Station = "Station", Fetched = "Abgerufen", Data_processed = "Daten verarbeitet", new_version = "New version of WUWeather.lua script is out! ", script_url = "http://jonnylarsson.se/JL/", No_data_fetched = "Keine Daten abgerufen", Update_interval = "Das nächste Update in (min)", NO_STATIONID_FOUND = "Keine stationID gefunden", NO_DATA_FOUND = "Keine Daten gefunden" } WU.translation["NO"] = { Exiting_loop_push = "Exiting_loop_push", Push_forecast = "Push værmelding", Temperature = "Temperatur", Humidity = "Fuktighet", Pressure = "Barometer", Wind = "Vind", Rain = "Regn", Forecast = "Prognose", Station = "Stasjon", Fetched = "Hentet", Data_processed = "All data prosessert", Update_interval = "Neste oppdatering om (min)", No_data_fetched = "Ingen data hentet", NO_STATIONID_FOUND = "StasjonID ikke funnet", NO_DATA_FOUND = "Ingen data hos WU" } WU.translation["CZ"] = { Exiting_loop_push = "Exiting_loop_push", Push_forecast = "Push forecast", Temperature = "Teplota", Humidity = "Vlhkost", Pressure = "(Atmosférický) Tlak", Wind = "Vítr", Rain = "Déšť ", Forecast = "Předpověď", Station = "Stanice", Fetched = "Předána", Data_processed = "Data_zpracována", Update_interval = "Časová_prodleva_mezi_aktualizacemi", No_data_fetched = "Data_nebyla_předána", NO_STATIONID_FOUND = "Stanice_nenalezena", NO_DATA_FOUND = "Data_Nenalezena" } WU.translation["RO"] = { Exiting_loop_push = "Exiting_loop_push", Push_forecast = "Prognoza apăsare", Temperature = "Temperatura", Humidity = "Umiditate", Pressure = "Presiune", Wind = "Vant", Rain = "Ploaie", Forecast = "Prognoza", Station = "Statie", Fetched = "Preluat", Data_processed = "Datele prelucrate", Update_interval = "Urmatorul update va fi in (min)", No_data_fetched = "Nu exista date preluate", NO_STATIONID_FOUND = "Nu a fost gasit stationID ", NO_DATA_FOUND = "Datele nu au fost gasite" } WU.translation["GR"] = { Exiting_loop_push = "Exiting_loop_push", Push_forecast = "Πρόγνωση push", Temperature = "Θερμοκρασία", Humidity = "Υγρασία", Pressure = "Πίεση", Wind = "Άνεμος", Rain = "Βροχή", Forecast = "Πρόβλεψη", Station = "Σταθμός", Fetched = "Παραλήφθηκαν", Data_processed = "Επεξεργασμένα δεδομένα", Update_interval = "Η επόμενη ενημέρωση θα γίνει σε (min)", No_data_fetched = "Δεν παραλήφθηκαν δεδομένα", NO_STATIONID_FOUND = "Δεν βρέθηκε το Station ID", NO_DATA_FOUND = "Δεν βρέθηκαν δεδομένα" } WU.translation["PT"] = { Exiting_loop_push = "Exiting_loop_push", Push_forecast = "Previsão do impulso", Temperature = "Temperatura", Humidity = "Humidade", Pressure = "Pressão", Wind = "Vento", Rain = "Chuva", Forecast = "Previsão", Station = "Estação", Fetched = "Procurar", Data_processed = "Dados processados", Update_interval = "Próxima atualização será em (min)", No_data_fetched = "Não foram encontrados dados", NO_STATIONID_FOUND = "Não foi detetada nenhuma estação", NO_DATA_FOUND = "Não foram encontrados dados" } WU.translation["RU"] = { Exiting_loop_push = "Exiting_loop_push", Push_forecast = "Прогноз Нажмите", Temperature = "Температура", Humidity = "Влажность", Pressure = "Давление", Wind = "Ветер", Rain = "Дождь", Forecast = "Прогноз", Station = "Станция", Fetched = "Получено", Data_processed = "Данные обработаны", Update_interval = "Следующее обновление через (мин.)", No_data_fetched = "Данные не получены", NO_STATIONID_FOUND = "Данная станция не найдена", NO_DATA_FOUND = "Данные не найдены" } WU.translation["ES"] = { Exiting_loop_push = "Exiting_loop_push", Push_forecast = "Pronóstico enviado", Temperature = "Temperatura", Humidity = "Humedad", Pressure = "Presión", Wind = "Viento", Rain = "Precipitaciones", Forecast = "Pronóstico", Station = "Estación", Fetched = "Extraído", Data_processed = "Datos procesados", Update_interval = "La próxima actualización será en (min)", No_data_fetched = "Ningún dato extraído", new_version = "Nueva versión del script WUWeather.lua disponible! ", script_url = "http://jonnylarsson.se/JL/", NO_STATIONID_FOUND = "No se ha encontrado la stationID", NO_DATA_FOUND = "Datos no encontrados" } if WU.station == "LOCID" then locationID = WU.LOCID elseif WU.station == "PWS" then locationID = WU.PWS end Debug = function ( color, message ) fibaro:debug(string.format('<%s style="color:%s;">%s</%s>', "span", color, message, "span")); end function log(str) if debug then fibaro:debug(str); end end function errorlog(str) fibaro:debug("<font color='red'>"..str.."</font>") end function Telegrambot(msg) -- Read settings from variable WU.Telegramtoken1 = fibaro:getGlobal("Telegramtoken1_part1")..":"..fibaro:getGlobal("Telegramtoken1_part2") WU.Telegramchat_id1 = fibaro:getGlobal("Telegramchat_id1") WU.Telegramurl1 = "https://api.telegram.org/bot"..WU.Telegramtoken1.."/sendMessage?chat_id="..WU.Telegramchat_id1.."&text=" if WU.dualChat_ID then WU.Telegramtoken2 = fibaro:getGlobal("Telegramtoken2_part1")..":"..fibaro:getGlobal("Telegramtoken2_part2") WU.Telegramchat_id2 = fibaro:getGlobal("Telegramchat_id2") WU.Telegramurl2 = "https://api.telegram.org/bot"..WU.Telegramtoken2.."/sendMessage?chat_id="..WU.Telegramchat_id2.."&text=" end -- End read settings from variable local selfhttp = net.HTTPClient({timeout=2000}) url = WU.Telegramurl1 .. msg selfhttp:request(url, { options={ headers = selfhttp.controlHeaders, data = requestBody, method = 'GET' }, success = function(status) local result = json.decode(status.data); if result.ok == true then Debug("grey", "Sucessfully sent message to Telegram Bot...") else --errorlog("failed"); print(status.data); end end, error = function(error) --errorlog("ERROR") Debug("red", error) end }) if WU.dualChat_ID then url2 = WU.Telegramurl2 .. msg selfhttp:request(url2, { options={ headers = selfhttp.controlHeaders, data = requestBody, method = 'GET' }, success = function(status) local result = json.decode(status.data); if result.ok == true then Debug("grey", "Sucessfully sent message to Telegram Bot...") else --errorlog("failed"); print(status.data); end end, error = function(error) --errorlog("ERROR") Debug("red", error) end }) end end function versionChecker() local function getMethod(requestUrl, successCallback, errorCallback) local http = net.HTTPClient() http:request(requestUrl, { options = { method = 'GET', headers = { }, }, success = successCallback, error = errorCallback }) end content = "WUWeather.lua" local url = 'http://jonnylarsson.se/JL/'..content getMethod(url, function(resp) s = resp.data serverVersion = string.match(s, "{V(.-)}"); scriptVersion = string.match(version, "{V(.-)}"); if serverVersion > scriptVersion then Debug("grey", "Checking script version...") Debug("yellow", "There is a new version out! "..'<a href="http://jonnylarsson.se/JL/WUWeather.lua" target="_blank" style="display:inline;color:Cyan">Get it!</a>') if WU.sendPush then for k,smartphoneID_and_fcst in ipairs(smartphoneID_and_fcst) do if smartphoneID_and_fcst[4] == "Fibaro" then fibaro:call(smartphoneID_and_fcst[1] , "sendPush", WU.translation[WU.language]["new_version"].." "..WU.translation[WU.language]["script_url"]) elseif smartphoneID_and_fcst[4] == "Telegram" then Telegrambot(WU.translation[WU.language]["new_version"].." "..WU.translation[WU.language]["script_url"]) end end end end end, function(err) print('error' .. err) end ) end local http = net.HTTPClient() local function errorWU(err) if WU.pushOption == "Fibaro" then fibaro:call(WU.smartphoneID , "sendPush", "[WUWeather scene]. Error: "..err ) elseif WU.pushOption == "Telegram" then Telegrambot("[WUWeather scene]. Error: "..err ) end Debug( "red", "[HTTPClient:request]. Error: "..err ); end local function sendPopup() -- variable containing path of Motion Sensor’s icon local imgUrl = popupIMG -- pop-up call HomeCenter.PopupService.publish({ -- title (required) title = 'Weather forecast', -- subtitle(optional), e.g. time and date of the pop-up call subtitle = os.date("%I:%M:%S %p | %B %d, %Y"), -- content header (optional) contentTitle = 'Forecast from WU Weather', -- content (required) contentBody = fcastday.." - "..fcast, -- notification image (assigned from the variable) img = imgUrl, -- type of the pop-up type = 'Info', }) end function createGlobalIfNotExists(varName, defaultValue) if (fibaro:getGlobal(varName) == nil) then Debug("cyan", "Creating the variable: "..varName.." with value: "..defaultValue) newVar = {} newVar.name = varName newVar.value = defaultValue local http = net.HTTPClient() http:request("http://127.0.0.1:11111/api/globalVariables", { options = { method = 'POST', data = json.encode(newVar)}}) end end local function processWU(response) http:request("http://api.wunderground.com/api/"..WU.APIkey.."/conditions/forecast/lang:"..WU.language.."/q/"..WU.station..":"..locationID..".json",{ options = {method = 'GET'}, success = processWU, error = errorWU }) Debug( "green", "Now downloading data from www.wunderground.com"); if response then -- the first time you enter the loop, this will be nil jsonTable = json.decode(response.data) if jsonTable.response.error ~= nil then Debug( "red", jsonTable.response.error.description) else jsonTable = json.decode(response.data) WU.now = os.date("%H:%M") stationID = jsonTable.current_observation.station_id city = jsonTable.current_observation.observation_location.city humidity = jsonTable.current_observation.relative_humidity temperature = jsonTable.current_observation.temp_c pression = jsonTable.current_observation.pressure_mb wind = jsonTable.current_observation.wind_kph rain = jsonTable.current_observation.precip_today_metric icon = jsonTable.current_observation.icon weathericon = jsonTable.current_observation.icon_url fcstday1 = jsonTable.forecast.txt_forecast.forecastday[1].title fcst1 = jsonTable.forecast.txt_forecast.forecastday[1].fcttext_metric fcst1icon = jsonTable.forecast.txt_forecast.forecastday[1].icon_url fcstday2 = jsonTable.forecast.txt_forecast.forecastday[2].title fcst2 = jsonTable.forecast.txt_forecast.forecastday[2].fcttext_metric fcst2icon = jsonTable.forecast.txt_forecast.forecastday[2].icon_url fcstday3 = jsonTable.forecast.txt_forecast.forecastday[3].title fcst3 = jsonTable.forecast.txt_forecast.forecastday[3].fcttext_metric fcst3icon = jsonTable.forecast.txt_forecast.forecastday[3].icon_url fcst1_mobile = jsonTable.forecast.simpleforecast.forecastday[1].conditions fcst2_mobile = jsonTable.forecast.simpleforecast.forecastday[2].conditions if (stationID ~= nil) then fibaro:call(WU.selfId , "setProperty", "ui.lblStation.value", locationID); fibaro:call(WU.selfId , "setProperty", "ui.lblCity.value", city); fibaro:call(WU.selfId , "setProperty", "ui.lblTemp.value", WU.translation[WU.language]["Temperature"].." "..temperature.." °C"); fibaro:call(WU.selfId , "setProperty", "ui.lblHum.value", WU.translation[WU.language]["Humidity"].." "..humidity); fibaro:call(WU.selfId , "setProperty", "ui.lblBar.value", WU.translation[WU.language]["Pressure"].." "..pression.." mb"); fibaro:call(WU.selfId , "setProperty", "ui.lblWind.value", WU.translation[WU.language]["Wind"].." "..wind.." km/h"); fibaro:call(WU.selfId , "setProperty", "ui.lblRain.value", WU.translation[WU.language]["Rain"].." "..rain.." mm"); if (WU.now >= "03:00" and WU.now <= "15:59") then fibaro:call(WU.selfId , "setProperty", "ui.lblFcst.value",WU.translation[WU.language]["Forecast"].." "..fcstday1.." - "..fcst1_mobile); --fibaro:call(WU.selfId , "setProperty", "ui.lblIcon.value","<img src=http://jonnylarsson.se/JL/png/"..icon..".png>"); elseif (WU.now >= "16:00" and WU.now <= "23:59") then --fibaro:call(WU.selfId , "setProperty", "ui.lblIcon.value","<img src=http://jonnylarsson.se/JL/png/nt_"..icon..".png>"); fibaro:call(WU.selfId , "setProperty", "ui.lblFcst.value", WU.translation[WU.language]["Forecast"].." "..fcstday2.." - "..fcst2_mobile); end if WU.sendPush then for k,smartphoneID_and_fcst in ipairs(smartphoneID_and_fcst) do if (os.date("%H:%M") == smartphoneID_and_fcst[2]) then if versionCheck then versionChecker() end if smartphoneID_and_fcst[4] == "Fibaro" then fcastday = fcstday1 fcast = fcst1 fibaro:call(smartphoneID_and_fcst[1], "sendPush", fcstday1.." - "..fcst1) popupIMG = "http://jonnylarsson.se/JL/png/"..icon..".png" sendPopup() Debug("grey", "Sucessfully sent push message to "..smartphoneID_and_fcst[1]) elseif smartphoneID_and_fcst[4] == "Telegram" then Telegrambot(fcstday1.."%0A"..string.lower(fcst1).."%0A"..fcst1icon.."%0A".."%0A"..fcstday2.."%0A"..string.lower(fcst2)) elseif smartphoneID_and_fcst[4] == "Pushover" then fibaro:setGlobal("pushoverBody", fcstday1.." - "..string.lower(fcst1).." - "..fcst1icon) end end end for k,smartphoneID_and_fcst in ipairs(smartphoneID_and_fcst) do if (os.date("%H:%M") == smartphoneID_and_fcst[3]) then if smartphoneID_and_fcst[4] == "Fibaro" then fcastday = fcstday2 fcast = fcst2 fibaro:call(smartphoneID_and_fcst[1] , "sendPush", fcstday2.."\n"..string.lower(fcst2).."\n"..fcst2icon.."\n".."\n"..fcstday3.."\n"..string.lower(fcst3)) popupIMG = "http://jonnylarsson.se/JL/png/nt_"..icon..".png" sendPopup() Debug("grey", "Sucessfully sent push message to "..smartphoneID_and_fcst[1]) elseif smartphoneID_and_fcst[4] == "Telegram" then Telegrambot(fcstday2.."%0A"..string.lower(fcst2).."%0A"..fcst2icon.."%0A".."%0A"..fcstday3.."%0A"..string.lower(fcst3)) elseif smartphoneID_and_fcst[4] == "Pushover" then fibaro:setGlobal("pushoverBody", fcstday2.."\n"..string.lower(fcst2).."\n"..fcst2icon.."\n".."\n"..fcstday3.."\n"..string.lower(fcst3)) end end end end if WU.sendPush then fibaro:call(WU.selfId , "setProperty", "ui.lblNotify.value", WU.translation[WU.language]["Push_forecast"].." = true"); else fibaro:call(WU.selfId , "setProperty", "ui.lblNotify.value",WU.translation[WU.language]["Push_forecast"].." = false"); end WU.scheduler = os.time()+updateEvery*60 fibaro:call(WU.selfId, "setProperty", "ui.lblUpdate.value", os.date("%c")); fibaro:debug(WU.translation[WU.language]["Data_processed"]) fibaro:debug(WU.translation[WU.language]["Update_interval"].." "..updateEvery) else fibaro:debug(WU.translation[WU.language]["NO_STATIONID_FOUND"]) end end sleepAndcheck = 0 while sleepAndcheck <= 20*updateEvery do fibaro:sleep(3000) sleepAndcheck = sleepAndcheck+1 for k,smartphoneID_and_fcst in ipairs(smartphoneID_and_fcst) do if (DoNotRecheckBefore <= os.time()) and ((WU.scheduler == os.time) or (os.date("%H:%M") == smartphoneID_and_fcst[2]) or (os.date("%H:%M") == smartphoneID_and_fcst[3])) then fibaro:debug(WU.translation[WU.language]["Push_forecast"]) Debug("orange", WU.translation[WU.language]["Exiting_loop_push"]); DoNotRecheckBefore = os.time()+60 sleepAndcheck = 20*updateEvery end end end end end Debug( "orange", "WU Weather - LUA Scripting by Jonny Larsson 2015/2016" ); Debug( "orange", "Version: "..version); if versionCheck then versionChecker() end createGlobalIfNotExists("WUAPI", WU.APIkey) createGlobalIfNotExists("Telegramtoken1_part1", WU.Telegramtoken1_part1) createGlobalIfNotExists("Telegramtoken1_part2", WU.Telegramtoken1_part2) createGlobalIfNotExists("Telegramchat_id1", WU.Telegramchat_id1) if WU.dualChat_ID then createGlobalIfNotExists("Telegramtoken2_part1", WU.Telegramtoken2_part1) createGlobalIfNotExists("Telegramtoken2_part2", WU.Telegramtoken2_part2) createGlobalIfNotExists("Telegramchat_id2", WU.Telegramchat_id2) end for k,smartphoneID_and_fcst in ipairs(smartphoneID_and_fcst) do Debug( "yellow", "Morning forecast push will be for ID: "..smartphoneID_and_fcst[1].." @ "..smartphoneID_and_fcst[2].." with "..smartphoneID_and_fcst[4]); Debug( "yellow", "Afternoon forecast push will be for ID: "..smartphoneID_and_fcst[1].." @ "..smartphoneID_and_fcst[3].." with "..smartphoneID_and_fcst[4]); end processWU() --this starts an endless loop, until an error occurs ---- END OF UPDATE ----
  3. Hi all Is there a fibaro killscene and startscene command similar to hc2? Thanks
  4. Dear All, I'm confused to run scene with or without "while true do" cycle to use scene all triggered command change. I have the following easy code without "while true do" to change the airfresh working status if the alarm system is on or off. Work without an problem, if the alarm system status ( thrue smart implant input ) is changed the wall plug of the airfresh also changed Here is the LUA code: --[[ %% autostart %% properties 34 value %% events %% globals --]] local alarm local airfreshId = 55; local airfreshStatus function airfresh() alarm = tonumber(fibaro:getValue(34, 'value')); airfreshStatus = tonumber(fibaro:getValue(airfreshId, 'value')); if ( alarm == 0 and airfreshStatus == 0 ) then fibaro:call(airfreshId, "turnOn"); elseif ( alarm == 1 and airfreshStatus == 1 ) then fibaro:call(airfreshId, "turnOff"); end; end; -- Main program airfresh(); And here is the similar LUA code when I need to switch on or off the bathroom electrical radiator heating. If I use this LUA code without "while true do" cycle and I change the termostat adjustment no any action happened. If I use the same code with "while true do" cycle this work perfect. --[[ %% autostart %% properties 28 value 29 value 281 value 272 value %% events %% globals --]] local thermostat -- id:28 radiator thermosztat local roomtemp -- id:29 room temperature local radiatorheatId = 54; -- id:54 radiator heating local heatingwater -- id:281 boiler heating water temp local heatingwaterpump -- id:272 heating water pump local tempswitch = true; function radiator() thermostat = tonumber(fibaro:getValue(28, 'value')); roomtemp = tonumber(fibaro:getValue(29, 'value')); heatingwater = tonumber(fibaro:getValue(281, "value")); heatingwaterpump = tonumber(fibaro:getValue(272, "value")); if ( (roomtemp - thermostat) >= 0 ) then tempswitch = false; else tempswitch = true; end; if ( ( tempswitch == true and heatingwater < 30 and heatingwaterpump == 0 ) ) then fibaro:call(radiatorheatId, "turnOn"); else fibaro:call(radiatorheatId, "turnOff"); end; end; -- Main program while true do radiator(); fibaro:sleep(60000); -- Wait 1 minute end; Can you please advise why I need to run while true do cycle in the 2nd program, if the 1st program run without this cycle perfect ? Thank you
  5. Hello, I'm interested to learn more about scripting to automate the home with HC3. Which "languages" would you recommend to learn? I know there is documentation about LUA on manuals.fibaro.com, but I don't have any "programming skills" yet. So that a step to far for me at the moment. I also found this app https://getmimo.com/ (not sponsored content), maybe this is something easy to understand the basics. Let me know if you have any other suggestion!
  6. Hi guys I ask for Lua scene to control the lights automatically into star's by motion detection bt problem not for that The problem is I want that scene work between 6 pm to 7am and if motion detection don't detect any move then turn off light after 20 minutes Any one hare can help my to do that And Thanks for every one
  7. I use the following code and it gives me nicely a table of devices when applied in a scene, however when I apply it in Main of a VD, it returns null. Anyone a suggestion ? local data = { args = { 1 }, filters = { { filter = "hasProperty", value = { "power" } } } } local devices = fibaro:callGroupAction("deviceID", data)
  8. can someone help me? I am trying to create a scene that checks to see if a variable changes. if variable x=1 don't check variable (do nothing) but if variable x=0 then continuously search to see if a variable x changes from 0 to 1 then the loop stops until variable x changes to 0 again. *yes there is another scene that will change it from 0 to 1. *Edit, I figured this out.
  9. Hi Everyone, Since a couple of weeks im trying to learn a bit about Lua programming. At the moment im struggling to find an answer to my problem. To switch floor heating pump i used a power plug on my central heating boiler to measure the power usage to turn on the power of the floor heating pump (also a power plug). First i made a simple block scene which worked fine at first but now i found out that also when im using tap water the central heating boiler is using a significant amount of power. so the idea is to use the living room temp. sensor and the power measurement of the central heating boiler to switch the floor heating pump. Since the margin is very small im trying to do a double check so check if the conditions match, sleep for 3 minutes and check the conditions again before powering off. This is a bit of the code i used but get a error. if (PowerCV <'1') and (PompStatus >'1') then fibaro:debug('wacht 3 min voor uitschakelen') fibaro:sleep(10000) fibaro:debug(' 3 min later') and (PowerCV <'1') and (PompStatus >'1') then fibaro:call(191, "turnOff") fibaro:debug('Pomp staat nu uit') end it seems like im not able to check another set of conditions after the "sleep". is there a way to do this? all help is appreciated. thank!
  10. I have a scene that gets the sunrise and sunset for the day. I recently noticed that both sunrise and sunset times are not correct. They are about 30min - 1 hour off from what they should be. has anyone else seen this issue? Does anyone know if fibaro is going to fix it? @T.Konopka
  11. I have come across several Fibaro LUA functions that do not seem to be documented in the available Fibaro LUA manual. Here are a few examples: fibaro:getName(id) fibaro:getRoomNameByDeviceID(id) The use of formatting codes in fibaro:debug("text") And fibaro:call(id, "sendPush", "text..") and similar commands for e-mail etc. I have successfully used all of these and probably more. I am sure there are still more functions/calls out there which are only known from scenes published on the forum. Is there a more complete documentation available? Has anyone collected these semi-secret functions into a private document that may be shared?
  12. Guys, i simple need to send this command using a VD: Button1: PUT http://admin:[email protected]/ISAPI/ContentMgmt/record/control/manual/start/tracks/101 Button2:PUT http://admin:[email protected]/ISAPI/ContentMgmt/record/control/manual/stop/tracks/101 How can i do? Do u have some example? There ia also a way to check the status of the command? Regards Gianluca
  13. Hi Everyone v 2.6 now available for users that have the SMsgH installed Three offerings - Please read below to see which is right for you 1) WWWAPI Monitor {v1.0} - New (Mar8th) - vd that monitors only availability of the internet with option for sonos-api device. (leverages Smart Message Hub {v1.0} 2) Network Device Monitor VD {v2.5} - vd that can monitor several + devices and has built-in alert notification options (pushover/pc2popup/hc2email/allinone) or 3) Network Device Monitor VD {v2.6} - vd that can monitor several + devices and deigned to be used with the recently released Smart Message Hub {v1.0} Regards [Autofrank] LAN Monitor / Network Device Monitor {v2.6} ------ to be used with Smart Message Hub {v 1.0} Modified to to be used with Smart Message Hub - Label check removed to simplify virtual device 4 simple steps to upgrade from v2.5 to v2.6 Import the new virtual device Configure your SendMsg preferences Copy your v2.5 jsonNetwork table to v 2.6 and set UpdateData to 'true' Set UpdateData to 'false' and that's it !! LAN Monitor / Network Device Monitor {v2.5} ------ has built in Notification Services The main difference between 2.0 and 2.5 are the following Virtual Device ONLY - ( no need for separate scene, table updates are now done through VD) Global variable table is created automatically created for new users Added HC2 Popup service as an extra notification option The following features are still available Individual LAN devices can be marked for Alert Alert Notification options configurable for HC2 email (default), pushover, or ALLINONE (@jompa68) One Alert will be received when device goes offline and another when it comes back online Online/Offline status is captured in global table that can be used to trigger other events Debug routine called vdCheck will verify that correct quantity of vd labels and format was setup Status/Error/Check feedback through the virtual device log console as visible through the Web UI I use this to monitor Internet, Unifi Security Gateway, HC2, Sonos API (pi), TV's, Sat Box, Apple TV, Droid Box, Alarm Panel, Alarm Gateway, Syn NAS Global cache device, Cameras, Tablets, Sonos players, Access points and phones. Alerts setup for Internet, USG, Sonos API, Access points, cameras, Sonos players, Alarm panel, alarm gateway and NAS. There are some nuances with some devices such as TV's and Phones. Open Ports of some devices that were shared by users Internet google (port 80) Sonos players/zone (port 1400) Sonos API (port 5005 or 5006) Raspberry Pi Hosting API (port 22) iPhone Port (port 62078) Smarter coffee maker (port 2081) Smarter iKittle (port 2081) Philips TV 47PFL5000 (port 1925) Foscam cameras (port 88) NAS Netgear U6 (port 80) Global cache GC100-12 (port 21) Humax FoxSat satellite receiver(port 80) Apple TV Gen 3 (port 5000) NPET MXQ Pro TV Box - Android 5.1 (port 7002) Sony TV’s (port 80) Samsung TV (port 8080) Synology NAs DS415Play (port 80) SPC Gateway (port 80) Siemens Alarm Panel (port 443) HKVision IP Camera (port 80) Unifi security Gateway (port 80) Unifi UniFi AC LR Access Point (port 22) Samsung Galaxy S6 / S7 (port 5060) Samsung Tablet (port 5060) Generic Android Tablets (port 5060) Airport Express and Airport Extreme (port 5009) Amazon Echo Dot and Fullsize Echo (port 4070) == INSTALLATION: Upgrading from 2.0 == - Import the LAN Monitor 2.5 VD and copy in device table from Update Network Table 2.0 - Run VD with updateData = "true" to update the Network table (default setting is false) - Run VD with updateData = "false" to operate in normal mode - Update notification and frequency of update options == INSTALLATION: First Time Users == STEP 1 - Import the LAN Monitor 2.5 virtual device - Populate the device table. Device, ip, port and enter alert = "1" for device notification - alert is user configurible per device - alert = 1 (enable alerts - alerts sent if it goes offline or comes back online ) - alert = 0 (disable alerts for this device) - Select the notification options - Run VD with updateData = "true" to populate the device table - Run VD with updateData = "false" to operate in normal mode Step 2 (optional) - create labels to display device status in VD - Create one label for each device in the global variable table, use the default ID - Label1, Label2, etc. - Enter Label Names (1, 2, 3, etc) to match order order of devices in Table (devices can be skipped but ID's must match) - Select Main label to display one device when observing through Web UI - If you want to use all labels you can use Set vdCheck = "true" to confirm correct quantity and format of labels. == FILES == Use the version if you don't have Smart Message Hub installed >> Network device Monitor VD {v2.5} ------------> LAN_Monitor_2.5.vfib Use this version if you HAVE Smart Message Hub installed >> Network Device Monitor VD {v 2.6} -----------> LAN_Monitor_2.6.vfib Thanks to @jompa68 , @petergebruers , @sonnyboy and @boerremk for their input Regards -f
  14. Witam, Od wczoraj zmagam się z problemami z HC2. Sceny nie uruchamiają się automatycznie. Miałem wcześniej dużo działących już scen i dopisałem wczoraj nową i przestało działać. Robiłem kilka restartów i nic. Nie widziałem, żeby firmware się aktualizował. Obecna wersja to 4.530. Jeśli odpalę sceny ręcznie to zadziałają, więc kod jest poprawny. Jakieś pomysły?
  15. The documentation on Fibaro LUA states that the call fibaro:get(deviceID, property) "gets the latest data (value and time of last modification) of the device properties". The similar call fibaro:getValue(deviceID, property) is said to "get the current value of the device (deviceID) property". Apart from the difference that the first call may also retrieve the time of last modification, they seem to do identical jobs. I have seen, however, (I forget where) that the wording latest and current is significant. Am I right that the fibaro:get call retrieves its value from the latest value stored in the HC2, while the fibaro:getValue call retrieves it directly by a call to the device? If so, it is worth knowing when making a choice between the two, and the documentation could have been clearer. My specific reason for asking, is that I have a Fibaro door/window sensor, where the temperature measurement has been unchanged for several days, which is unlikely. In a small test script I used both the get and the getValue calls, and they returned identical values. The call used was simply fibaro:getValue(520, "value") and similarly for get. Time of last modification confirms that the value has not been changed for 215 000 seconds (60 hours). If communication had been lost with this device, would it not refuse to return a value from the getValue call? Or does it use the stored value if the device is unresponsive?
  16. Tried to combine two converted blok scenes to one, but now it wont trigger... Any suggestions ? ------------------------------------------------------------------------------------------------------------------------- --[[ %% autostart %% properties %% weather %% events %% globals --]] local sourceTrigger = fibaro:getSourceTrigger(); local currentDate = os.date("*t"); local startSource = fibaro:getSourceTrigger(); if ( ( ((currentDate.wday == 1 or currentDate.wday == 2 or currentDate.wday == 3 or currentDate.wday == 4 or currentDate.wday == 5 or currentDate.wday == 6 or currentDate.wday == 7) and string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) == "04:00") ) or ( ((currentDate.wday == 1 or currentDate.wday == 2 or currentDate.wday == 3 or currentDate.wday == 4 or currentDate.wday == 5 or currentDate.wday == 6 or currentDate.wday == 7) and string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) == "15:00") ) ) then fibaro:setGlobal("reclameverl", "1"); fibaro:debug("var reclverl set to 1") fibaro:sleep(60*1000) elseif ( ( ((currentDate.wday == 1 or currentDate.wday == 2 or currentDate.wday == 3 or currentDate.wday == 4 or currentDate.wday == 5 or currentDate.wday == 6 or currentDate.wday == 7) and string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) == "09:00") ) or ( ((currentDate.wday == 1 or currentDate.wday == 2 or currentDate.wday == 3 or currentDate.wday == 4 or currentDate.wday == 5 or currentDate.wday == 6 or currentDate.wday == 7) and string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) == "18:00") ) ) then fibaro:setGlobal("reclameverl", "0"); fibaro:debug("var reclverl set to 0") fibaro:sleep(60*1000) end ---------------------------------------------------------------------------------------------------------------------------------------------------- I,m hoping someone can give me a hint.... Gary set var reclverl.lua
  17. Hi could some explain to me what kind of variable or syntax this command needs fibaro:call(ID_RGB_CONTROLLER, "setColor", "0", "255", "0", "0") If i define local R_value = 255 fibaro:call(ID_RGB_CONTROLLER, "setColor", R_value, "255", "0", "0") "R_value" is not defined. The command fails. I tried character and single numeric, global and local etc. or do i have to use a table for all of the 4 values? I didn't find an example. Thanks Gerhard
  18. Hi could some explain to me what kind of variable or syntax this command needs fibaro:call(ID_RGB_CONTROLLER, "setColor", "0", "255", "0", "0") If i define local R_value = 255 fibaro:call(ID_RGB_CONTROLLER, "setColor", R_value, "255", "0", "0") "R_value" is not defined. The command fails. I tried character and single numeric, global and local etc. or do i have to use a table for all of the 4 values? I didn't find an example. Thanks Gerhard
  19. Cześć wszystkim! Jestem nowy na forum i nowy w temacie LUA. Walczę i szukam po forum od dłuższego czasu. Wiele problemów już rozwiązałem, ale ten zalazł mi konkretnie za skórę i potrzebuję pomocy ? Mam scenę, która ma działać zależnie od obecności w biurze. 3 czujniki po naruszeniu zaczynają odliczać czas i jeśli zostaną naruszone ponownie, odliczają od początku. Jeśli odliczą do zera to wyłączają światła i inne rzeczy. Oznacza to, że nikogo w biurze już nie ma. Kolejne naruszenie któregoś z czujnika wywołuje efekt odwrotny, czyli wszystko się włącza. Jest jednak jeden wyjątek, którym jest jeden z laptopów, którego nie obejmuje żaden czujnik. Jest on podpięty przez wallpluga i daje informację o zużyciu energii ~10W. Niestety nie umiem ustawić, aby po wyłączeniu laptopa scena zaczynała odliczać czas. Cały czas, bez względu na to czy jest on włączony czy nie, licznik stoi na maksymalnej wartości i nie zaczyna odliczania w dół. Zaczyna to odliczanie dopiero gdy zmieniłem wartość z "power" na "value" i dałem > 0 czyli włączony wallplug. Na ten moment działa to w ten sposób, czyli wnioskuję, że pozostałe elementy sceny są poprawne. Mimo wszystko nie zadowala rozwiązanie, w którym trzeba wyłączyć wallplug, żeby licznik zaczynał odliczać obecność w biurze. Pomocy, kod poniżej --[[ %% autostart %% properties 70 value 657 value 694 value 775 value %% events %% globals --]] --funkcje local czujnikbiuro = (tonumber(fibaro:getValue(70, "value")) > 0); local czujnikwejscie = (tonumber(fibaro:getValue(657, "value")) > 0); local czujnikmagazyn = (tonumber(fibaro:getValue(694, "value")) > 0); local delay = 600 --włączanie zmiennej PRACA = ON if czujnikbiuro or czujnikwejscie or czujnikmagazyn then fibaro:setGlobal("PRACA", "ON"); fibaro:debug("Witaj w salonie Fibaro"); end --uruchamianie pracy if fibaro:getGlobalValue("PRACA") == "ON" then fibaro:call(46, "open"); fibaro:debug("Zasłona została otwarta"); fibaro:startScene(349); fibaro:debug("Muzyka gra przez głośnik Sonos"); fibaro:startScene(530); fibaro:debug("Automatyczne działanie ekspozycji LED włączone"); fibaro:call(16, "turnOn"); fibaro:call(15, "turnOn"); fibaro:call(17, "turnOn"); fibaro:debug("Profile LED nad stołem zostały włączone"); fibaro:call(376, "setValue", "70"); fibaro:debug("AmstLED ustawiony na 70 procent"); fibaro:call(177, "turnOn"); fibaro:debug("Telewizor włączony"); fibaro:call(420, "turnOn"); fibaro:debug("Lampa nad TV włączona"); end --utrzymywanie stanu włączonego przez 10min bezruchu if fibaro:getGlobalValue("PRACA") == "ON" then local turnOffTime = os.time() + delay while turnOffTime > os.time() do if (tonumber(fibaro:getValue(657, "value"))) > 0 or (tonumber(fibaro:getValue(694, "value"))) > 0 or (tonumber(fibaro:getValue(70, "value"))) > 0 or (tonumber(fibaro:getValue(775, "value"))) > 0 then turnOffTime = os.time() + delay end fibaro:debug("zwłoka: "..tostring(turnOffTime - os.time())) fibaro:sleep(5000) end end --wyłączanie pracy po 10min bezruchu fibaro:call(46, "close"); fibaro:call(16, "turnOff"); fibaro:call(15, "turnOff"); fibaro:call(17, "turnOff"); fibaro:call(681, "turnOff"); fibaro:call(376, "turnOff"); fibaro:call(177, "turnOff"); fibaro:startScene(352); fibaro:debug("Do widzenia");
  20. This is not a question but a small contribution, if anyone should be interested. The task was this: How can I control indoor ventilation to avoid temperature/humidity combinations that risk growth of mold or mildew? The first trick was to find a simple formula for this risk zone. I used a calculator in www.dpcalc.org which indicates risk/no risk for a given temp/hum combination. Testing this for realistic values for normal indoor or basement use, I found this simple linear correlation would work: Humidity limit (%) = 91.2 - 1.184 * temp For temp>22 the limit is set constant at 65 %. Temperature is in degrees C. Example: If the temperature is 10 C, the relative humidity should stay below 79.4% to avoid the risk of mold growth. Assuming you have one or several ventilation fans, and one or several temperature/humidity measurements, you can use this to start the fans when the humidity level exceeds the limit. Alternatively, you can increase the set point for a relevant heater, to increase temperature and reduce relative humidity in the room. A push warning to the owner could also be included. I have chosen to only start the ventilation fans, and I include a small LUA script to achieve this. My temperature/humidity measurements are from two Aeotec Multi6 units, but any such sensor may be used. Feel free to implement any part of this script to suit your purpose. Please share here if you use these ideas in other ways or have related ideas yourself. Moldfan_demo.lua
  21. Hi, I am very confused by the functioning and documentation of "startLevelIncrease" that was made available a while ago. It is not documented, I think, outside of the release notes for the release, but the description there was: Ok, so I assume that devices with this call available in the interface when making a Lua scene will work for this. I also assume, since the documentation is a bit vague here, that the first optional parameter gives a time in milliseconds (usually the case) in which the change should have occurred, and a starting level. So, this code should dim up a light from 0 in 30 seconds then: fibaro:call(24, "startLevelIncrease",30*1000,0) But it does not. It dims in just about one second, and it does not matter att all what you specify in the third parameter. Trying it with a TKB plug in dimmer, which makes the call available in the Fibaro lua scene editor (so I guess it should work?)
  22. Hi everyone, is there any way how to obtain (access) information from HC2 heating schedules in LUA scripts? I need to work with information about what temperature and when it is going to be set in some particular rooms. I can workaround this by making heating schedules sort of static and completely overpass heating panel in HC2, but that would be a bit contra productive, right? Thanks Edit: BTW my first post here, so please be gentle
  23. Several posts on this forum recommend including a check in LUA scenes to ensure that only one instance of the scene is currently running. The recommended code is similar to this: if fibaro:countScenes() > 1 then scenes = fibaro:countScenes() fibaro:debug(os.date("%d %b").." Scenes active "..scenes) fibaro:abort(); end The main panel for each scene, however, includes a parameter controlling max. running instances: Why is it necessary to include the extra code, if this parameter already limits the scene to one active instance? Is it only to get the explicit warning from the fibaro:debug() command?
  24. Is there a way to get the user ids of the Home Centre, either manually through the UI or using Lua? If anybody has any pointers on how to use users in Lua that would help. At the moment I'm just trying to add them to a JSON table, but I would also like to use the user ids in code maybe. Thanks in advance.
  25. Witam Mam prośbę, czy mógłby mi ktoś rzucić okiem na kod pętli głównej urządzenia wirtualnego? Mianowicie chodzi o to, że urządzenie działa poprawnie, służy do sterowania klimakonwektorem, jednak nie wyświetla mi stanu poszczególnych elementów na etykietach. Co zrobiłem źle w kodzie pętli głównej? klima_salon_2(1).vfib
×
×
  • Create New...