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. Hoping someone can shed some light on this... Trying to send a HTTPS GET request to an AWS API Gateway endpoint. Here's the Lua code (obviously I've removed any privileged information for the purposes of posting here): httpClient = net.HTTPClient(); httpClient:request ( 'https://**********.execute-api.eu-west-1.amazonaws.com/****/***********', { options = { method = "GET", headers = { ['x-api-key'] = '*****************************' } }, success = function (response) fibaro:debug (response.data) end, error = function (err) fibaro:debug ("Error:" .. err) end }) I get an 'Error:Transport endpoint is already connected' message in the debug window. That's not a response from the API (no requests get logged on the AWS side, so the HC2 isn't getting as far as making the request at all.) If I try making a HTTPS request to another URL (like Google for example) it works with no issue. Also I know the API endpoint works, because I can call it from CURL and it does exactly what I expect. It's just from a scene. Seems like others have had the same issue, specifically with AWS API Gateway. Anyone know how to get this to work? Cheers, Dan
  2. Hi, I must confess that I use only "value", "lastBreached", "turnOn" and "turnOff" properties and commands for z-wave devices in my scenes. I don't actually know what "log" and "logTemp" and the others are. They may be very useful, but I cannot find any documentation for them. Are there any? Has anyone tried to figure out what they are, and maybe made a list?? Fredrik
  3. Witam Prośba do zespołu projektantów systemu. Może już czas na usprawnienie edytora skryptów LUA ? Można by dodać kilka nowych funkcji ( występujących w innych, popularnych edytorach ) takich jak: ctrl+g - skocz do linii numer ... ctrl+f - wyszukaj frazę ...... ctrl+h - zamień frazę .... na nową .... ctrl+s - zapisz poprawki ctrl+F1 - okno z pomocą - opis funkcji biblioteki fibaro pozycjonowanie kursora ( x, y ) - jest numeracja wierszy, brak numeracji kolumn własny dobór kolorystyki "elementów" skryptu (komentarzy, funkcji, łańcuchów znakowych, liczb itd. ) Wiem, że to nie jest potrzeba pierwszej kolejności ale wielu z nas aby dokonać zmian kopiuje skrypt, przenosi go do innego edytora i tam robi poprawki. Następnie poprawiony skrypt ponownie wkleja do edytora HC2. Usprawnienie edytora HC2 poprzez dodanie tych kilku funkcji wyeliminowałoby ten zbędny "zabieg".
  4. Hello A few months ago my virtual device for my engine heater became very slow and sometimes it doesn't work at all. Sometimes it gets better if i reboot the HC2 but it´s not funny when it´s -30 C and I get late to work because the car wont start and there is no way to be sure if it will work or not the next morning. Is this a known problem and is there a way to read the logfiles on the HC2? The diagnostics panel doesn't say much. The VD has been working great for several months before it became slow/not working. It might have happened after an upgrade. The controlled device works if i manually set i to active. Several other LUA scripts also became non working after an upgrade (cant remember if it happened at the same time) but I got them working just by changing something, save, change back and save again. I also get "to many instances" on other LUA scripts but not on the engine heater. Maybe they overload the HC2 and make it slow? I attached the VD and the scripts. LightsTimerToManyInstancesNotWorking.txt -- a timer that will turn off the lights if any of the two devices is on for more than xx minutes Motorvärmare_V-vfib-json -- The virtual device EngineHeaterLUA.txt -- the script for the VD LightsTimerToManyInstancesNotWorking.txt Motorvärmare_V.vfib.json EngineHeaterLUA.txt
  5. I really have a feeling someone will reply and i feel stupid... but.. How do you call a scene so it will start from a VD? fibaro:call(id,'start') doesn't work, and i can't really see examples for it.
  6. What is the syntax of sonos "text-to-speech" function in lua?
  7. Hi HC2 guru's Would a scene with a xxx value in the header/properties or a VD main loop be more efficient (ie use less resources) if I wanted to use a sensor (motion, light, humidity) to trigger an action. I find some of my sensors don't always react to a scene header trigger and in a vd. I think I could also exert a better level of control with repeat triggers with a vd but I wanted to make sure that this approach wouldn't impact the HC2 excessively Thanks -f
  8. Hi, i'm trying to execute this call using lua on the hc2 ws://<spc_web_gateway_host>:<port>/ws/spc/ Any idea how this could be done. thanks frank
  9. Hi, Just spotted the new UR weather device after the 4.11 upgrade It seems pretty accurate for my location can this be queries using lua or through the API Thanks Frank
  10. Apologies for the newbie question but, is there a LUA IDE application / tool already available, or does everyone tend to use the one they feel comfortable with?
  11. So I have a Good Morning Scene, and it executes other scenes.. I am struggling with understanding if lua waits for return of a scene or fires in parallel? The problem presents as this:- My good morning scene sets some globals, and executes scenes to switch alarms off and turn heating on (via scenes) etc.. then it builds a json table and puts it into a predefined Global... after that is calles a final scene that reads the global and TTS's it to speakers.. Problem is, half the time it seems to be reading the last updated speech body, and not the one that has just been set in the global.. is this a sequencing thing? or issue with globals? should I use a regular global and not a predefined one? I even tried to chain the scenes being called from good morning by nesting setTimeout functions..
  12. Dear All, I want to get into learning LUA. It seems that this is the right way to move forward if anyone is to use the HC2 seriously. However, as a newbie (relatively) to programming, I want to first understand if I need to learn other languages besides LUA in order to get the most out of the HC2. Any advice on where I should start this adventure?
  13. Hi there, I'm a developer but I'm fairly a newbie with LUA language and I'm having some problems undestanding the scope of the variables/functions, or maybe I'm just writing some garbage code... I need your help I want to use the native LUA function "load()" to evaluate a string and let it parse it as LUA code. I'm following LUA 5.2 documentation ( http://www.lua.org/manual/5.2/manual.html#pdf-load ) to use function, but I keep getting this error "attempt to call global "load" (a nil value) and I can't solve it. Here's my chunk of code: And here's the error Btw I'm using load() to make sure mainloop code is called right after button press, and not after 2/3 secs. Hope someone can help me out =) Thank you!
  14. Hi, I have implemented @cag014 HomeTable to track the device ID's of my HC2 the table structure is like this office = { Light=33,Temp=1186,Motion=1251,Lamp=720,rcSonos=1 }, Landing_Stairs = { stairsLight=92,landingLight=168,rcSonos=1 }, scene = { MainScene=614,AlarmControl=598,rebootHC2=593,goodMorning=463,goodNight=331,LeavingHome=483,welcomeHome=488,quietMorning=499,kidsToBed=490,plaroomTvOn=580,firstFloorMusicOn=579,firstFloorAllOff=578, hallSceneControl=519,StairsLight30=556,GateOpen5=526,GateOpenHold=361,GateOpenClose=425,DumpEventLog=565,PlayroomOff=617 }, vd = { AlarmManagement=881,TVPresets=1545,SonosTTS=1452,LightPresets=1534,HouseModeExt=1538,SonosPresets=1536,RackTempMngt=1453,MediaSourcePresets=1567,JhomeTable=1566,GateControl=1537,GarageControl=1559 }, I can update the whole table but was wondering if it was possible to update a specific vale such as "scene.AlarmControl" in the example I posted above. Any helpful code snippets gratefully accepted thanks -f
  15. Hi, I am converting and combining some of my scenes into Virtual devices I noticed that the main loop code seems to 'loop' every 3 seconds. I thought it was every one second here is the code and the debug screen function UpdateEventLog(eventStr) local currDate = (os.date("%b %d - %H:%M")) local updStr = (fibaro:getGlobal("Log_Event") .."".. currDate .." ".. eventStr .." \n") fibaro:setGlobal("Log_Event", updStr) end -- Auto lights Hotpress local HotPressLightID = 143 local HotPressDoorSensorID = 888 if (tonumber(fibaro:getValue(HotPressDoorSensorID, "value"))) == 1 then fibaro:call(HotPressLightID, "turnOn") UpdateEventLog("Hotpress auto-light activated") else fibaro:call(HotPressLightID, "turnOff") end -- Auto lights Dining Room local DiningCenterLightID = 25 fibaro:debug(tonumber(fibaro:getValue(DiningCenterLightID, "value"))) if ((fibaro:getGlobalValue("G_SPC_ZONE_INPUT_19") == "OPEN") and (fibaro:getGlobalValue("TODModeInside") == "night") and (tonumber(fibaro:getValue(DiningCenterLightID, "value"))) == 0) then fibaro:call(DiningCenterLightID, "setValue", "30") UpdateEventLog("Dining Room auto-lights activated") end Thanks Frank
  16. Multiroom Heating Controller My project was to write a multiroom heating controller to give indipendant control over each room using as much as the built in functionality of Home Center 2 as possible. Starting point: Create multiple rooms in the heating panel in accordance with the Advanced User Guide section 5.9.3 I did have some code to enumerate from these panels and get the following from the JSON files http://yourHC2IPAddress/api/panels/heating & http://yourHC2IPAddress/api/rooms Room Name, Room "Default Thermostat" & Default Temperature Sensor As I failed to add them to my array roomsArray I abandoned this for the time being. (Any developers want to help here??? You add your rooms to the roomsArray, set the HeatON and HeatOff as you need them these will stop overshoot of Temperature. - Any developers want to turn this in to a heating PID? I have been running this now for a couple of months without problem, and even moved it to other HC2 controllers. Make a LUA Scene, drope the code in, change the Variables and away you go. My setup and all I have tested with: HC2 v 4.1x Danfoss LC-13 TRVs these control the radiators and also act as a Thermostat for any room that does not have a external Thermostat Fibaro or AEON Multisensor for Temperature Sensor Secure SRT321 Wall thermostat & Secure HRT boiler Receiver - This was so i could put in manual mode if anything went wrong Happy to have suggeestions and additions! Enjoy! Brent --[[ %% autostart %% properties %% globals --]] -- REFERENCE -- forum.fibaro.com, lua.org, domotique-fibaro.fr, www.zwaveforum.net -- 0.0.1 2/11/16 iniital version -- 0.0.2 3/11/16 added get setpoint fucntion -- 0.0.3 4/11/16 Get Setpoints from Heating Panel -- Scrapped for -- 0.0. 11/11/16 Get default sensors from roms panel version = '1.0.0' -- 13/11/16 Stable version -- local arrays local roomsArray={} local heatOn = 0.7 -- temp has to drop this value below setpoint before boiler is on again -- adjust these two levels to reduce the sawtooth effect. local heatOff = 0.5 local smoothFactor = 3 local boilerControllerID=97 local programStart = os.time() local boilerOnTime = 0 local boilerOffTime = 0 local boilerOnTotal = 0 -- roomsArray[Room Name]={SetPointID, ThermostatID} -- These are temporary until Panels and Rooms Functions return Arrays roomsArray[1]={'Lounge',99,12} roomsArray[2]={'Master Bedroom',100,13} roomsArray[3]={'Kitchen',101,14} roomsArray[4]={'Bathroom',102,15} -------------------- USER SETTINGS ----------------------- --This will be redundant with version 0.0.4 debug = true -- set debug to true or false enumerateRooms = true -- Set this to true and within the debug window on the scene advance tab you will see room names and IDs enumerateSensors = true -- Set this to true to see within the Debug Window on the scene advance tab you will see Sensors for the room names and IDs enumerateErrors = true ----------------------------------------------------------- ------------- DO NOT CHANGE LINES BELOW ------------------- startSource = fibaro:getSourceTrigger(); -- Not using this at this time but will do BJB -- Give debug a fancy color Debug = function ( color, message ) fibaro:debug(string.format('<%s style="color:%s;">%s</%s>', "span", color, message, "span")); end Debug( "orange", "Read Heating Panel scene - LUA Scripting by Brent Brown 2016" ); Debug( "orange", "Version: "..version); -- Passed RoomID, ThermostatID, TemporatureSensorID -- Returns via adding to roomsArray TermostatSetpoint, currentTemperature, errorTemperature getTempError = function(room, tempID, thermID) local temperatureError = -999 if type(tonumber(fibaro:getValue(thermID, "targetLevel"))) ~= 'number' then if enumerateErrors == true then Debug("Green", "The device Thermostat in room " .. roomsArray[room][1] .. " has a NIL value!") Debug("Green", fibaro:getValue(thermID, "targetLevel")) temperatureError=0 end elseif type(tonumber(fibaro:getValue(tempID, "value"))) ~= 'number' then if enumerateErrors == true then Debug("Red", "The device temperature sensor in room " .. roomsArray[room][1] .. " has a NIL value!") Debug("Red", fibaro:getValue(tempID, "value")) temperatureError=0 end else roomsArray[room][5]=tonumber(fibaro:getValue(tempID, "value")) roomsArray[room][4]=tonumber(fibaro:getValue(thermID, "targetLevel")) roomsArray[room][6]=tonumber(fibaro:getValue(thermID, "targetLevel")) - tonumber(fibaro:getValue(tempID, "value")) end return temperatureError end meanTempFunc = function() local averageTempError, count = 0, 0 for k,v in pairs(roomsArray) do if debug == ture then Debug("White",roomsArray[k][6]) end if type(roomsArray[k][6]) ~= 'number' then if debug == ture then Debug("Red",roomsArray[k][1]..", TempError is not a number [Nil]") end elseif roomsArray[k][6] <= 0 then if debug == true then Debug("Red", roomsArray[k][1]..", is "..roomsArray[k][6]*-1 .."° above SetPoint") end else if debug == true then Debug("Blue", roomsArray[k][1]..", is: "..roomsArray[k][6]*-1 .."° below SetPoint") end averageTempError = averageTempError + roomsArray[k][6] count = count + 1 end end if count == 0 then averageTempError = 0 Debug("Blue","Average temperature across "..count.." room(s), is:"..averageTempError.."°") else averageTempError=averageTempError/count Debug("White","Average temperature across "..count.." room(s), is:"..averageTempError.."°") end return averageTempError end debugRoomFunc = function(room) if type(roomsArray[room][4]) == 'number' then Debug("White", roomsArray[room][1].." SetPoint Temperature is: "..roomsArray[room][4]) end if type(roomsArray[room][5]) == 'number' then Debug("White", roomsArray[room][1].." Sensor is showing the Temperature is: "..roomsArray[room][5]) end if type(roomsArray[room][6]) == 'number' then Debug("White", roomsArray[room][1].." Error Temperature is: "..roomsArray[room][6]) end end -- Main Process while true do local boilerOnTime for k, v in pairs(roomsArray) do --Debug("White", k..'.'..roomsArray[k][2]..'.'..roomsArray[k][3]) -- From each room get the Setpoint - Temperature to give ErrorTemperature getTempError(k,roomsArray[k][2],roomsArray[k][3]) end -- Get Each positive error temperature from roomArray[roomID][6] == ErrorTemp local meanTempError=meanTempFunc() Debug("Yellow",meanTempError) if meanTempError > 0 and meanTempError > heatOn then if tonumber(fibaro:getValue(boilerControllerID,"mode"))~=1 then fibaro:call(boilerControllerID, "setMode",1) boilerOnTime=os.time() Debug("Yellow", "Boiler on at = "..os.date("%X")) end end if meanTempError < heatOff then if tonumber(fibaro:getValue(boilerControllerID,"mode"))~=0 then fibaro:call(boilerControllerID,"setMode",0) boilerOnTotal=os.difftime(os.time(), boilerOnTime) Debug("White", "The boiler has been on for ".. boilerOnTotal.. " Seconds") fibaro:sleep(120000) -- Wait 2 mins whilst the latent heat tin the system keeps warming the room Debug("Yellow", "Boiler off at = "..os.date("%X")) end end --[[local whichRooms = "All" -- Options all or room 1,2,3,4,5, etc if whichRooms == "All" then for k, v in pairs(roomsArray) do debugRoomFunc(k) end -- Remove the comment "--" to show each of the room settings else debugRoomFunc(whichRooms) end --]] fibaro:sleep(30000) end Brent
  17. Hello Everyone, Today I was notified that LightwaveRF has publicly released a new API document. Hopefully, this will spawn a new raft of Virtual Devices that control LightwaveRF products as, if you live in the UK, you find this platform just works without major headaches and beta upgrades. The link is below: https://api.lightwaverf.com/introduction_basic_comms.html
  18. HI, Looking for some advice here I have a simple scenario. Enter room, sensor picks up the movement, lamp turns on. I can implement this as a scene (clode below) but I seem to get a lot of "too many instances", presumable because the sensor gets triggered when we are in the room I could also implement this as a VD in the main loop (code below) In terms of best practice or least load on the HC2 or what do our guru's generally do ? Thanks Frank VD Lua -- Configuration Device ID's local LivingRoomLamp = 1423 local LivingRoomLight = 231 if (fibaro:getGlobalValue("G_SPC_ZONE_INPUT_18") == "OPEN") and (fibaro:getGlobalValue("TODModeInside") == "night") and (fibaro:getValue(LivingRoomLight, "value") == "0") then fibaro:debug("turning on living room lamp") fibaro:call(LivingRoomLamp, "turnOn") end fibaro:sleep(3000) Scene Lua --[[ %% properties %% events %% globals G_SPC_ZONE_INPUT_18 --]] -- Configuration - Scene Info sceneName = "Autolights On for living room" sceneVersion = "1.0.1" -- Configuration Device ID's local LivingRoomLamp = 1423 local LivingRoomLight = 231 -- Validate Number of Scene Instance if (fibaro:countScenes()>1) then fibaro:debug("stop scene, to many instances") fibaro:abort() end function UpdateEventLog(eventStr) local currDate = (os.date("%b %d - %H:%M")) local updStr = (fibaro:getGlobal("Log_Event") .."".. currDate .." ".. eventStr .." \n") fibaro:setGlobal("Log_Event", updStr) end -- Main Scene Execution Code function tempFuncLiving() if (fibaro:getGlobalValue("G_SPC_ZONE_INPUT_18") == "OPEN") and (fibaro:getGlobalValue("TODModeInside") == "night") and (fibaro:getValue(LivingRoomLight, "value") == "0") then fibaro:debug("turning on living room lamp") fibaro:call(LivingRoomLamp, "turnOn") UpdateEventLog("living room auto lamp on") end fibaro:sleep(3000) end tempFuncLiving()
  19. I am trying to create a day/night setup via lua. Where at 8 am-10pm the variable is set to day and at 10pm-8am the variable is set to night. I cannot successfully do this via a block scene so i have used LUA to do this. Could someone help me look over my code to see if this is correct as i am fairly new in LUA. Thanks! --[[ %% autostart %% properties %% globals --]] -- Only need to call getSourceTrigger once -- For better debugging, I moved it to the top, -- before countScenes local sourceTrigger = fibaro:getSourceTrigger() fibaro:debug("Script started because of: " .. sourceTrigger["type"]) if fibaro:countScenes()>1 then fibaro:debug("Scene already running, aborting this one") fibaro:abort() end if (sourceTrigger["type"] == "autostart") then while true do local currentDate = os.date("*t") -- Do the time-string manipulation thingy here, instead of in -- each and every if-then statement -- %02u means unsigned int, 2 wide, leading zero TimeAsString = string.format("%02u",currentDate.hour).. ":" .. string.format("%02u", currentDate.min) fibaro:debug("TimeAsString: ".. TimeAsString) Day_night = fibaro:getGlobalValue("Day_night") fibaro:debug("Day_night: " .. Day_night) 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 TimeAsString == "8:00" then fibaro:debug("Setting scenario number 1") fibaro:setGlobal("Day_night", "Day") 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 TimeAsString == "22:00" then fibaro:debug("Setting scenario number 2") fibaro:setGlobal("Day_night", "Night") else fibaro:debug("Current time doesn't match any scenario") end end fibaro:debug("Scene not started, this is autostart-only!") end -- end of sourceTrigger["type"] == "autostart"
  20. Hi, I tried to get messages from my alarm system Honeywell Vista 10. To connect to the alarm system I use AD2Pi installed on Raspberry Pi. On Raspberry Pi started ser2sock program that redirect messages from serial to tcp. On HC2 I created VD, in which I can arm/disarm alarm system. I just sent the code for disarming I created a scene to get messages from alarm system, but always I see error message: [DEBUG] 11:35:40: line 12: attempt to index global 'Net' (a nil value) --[[ %% properties %% events %% globals --]] local ip = "10.0.1.5" local port = 10000 -- Initialising TCP-port if (tcpSocket == nil) then tcpSocket = Net.FTcpSocket(ip, port); tcpSocket:setReadTimeout(2000); end response, errorCode = tcpSocket:read() fibaro:log(tostring(response)); fibaro:debug(tostring(response)); My question: ser2sock sends messages about all alarm system events. How I can read and parsing messages from tcp? I always have to keep an open TCP connection, and when I get a new line, must run the parser. How to do this?
  21. Hi Guys. Im seeking a skilled LUA coder who can do some work for us with integrating a couple of things for HC2. For instance some advanced light control to make everything more automated But also integrating new products that has API into Fibaro.. Send me a message please and we can talk about it Thanks!
  22. I've got a HC2, Nest and some Danfoss-valves, eventually I want a Multi-zoned Heating Systems. = Modulating through a Nest = Problem is I live in The Netherlands and out here usually have Modulating Central Heating Systems. So I can't just use The Heating Panel and keep my pipes heated or not according to the outside temperature. With the Modulating system, I need to control my Central Heating through for example a Nest. I am controlling the Nest through an API, with the help of @TW1979 in topic "https://forum.fibaro.com/index.php?/topic/22466-nest-thermostat-v3-fibaro-plugin-not-updating-workaround-found" = LUA = I've read up on the Danfoss-radiator valves. (special thanks to: @tinman@Momos@hTiger1@petergebruers) * They're not that reliable. So before I start with the Multi-zone-LUA, here is my description of the LUA I'm gonna write for the one-room-system. Can someone tell me if this is gonna work? Global Variables: int Target_Temp_room1 Function:SCHEDULE Trigger : Time Action : Changes Target_Temp_room1 Function:EDIT Target_Temp_room1 WHEN THERMOSTAT IS CHANGED MANUALLY Trigger : Physical changes at Thermostat or manual changes in Fibaro GUI. Action : Change the Target_Temp_room1 accordingly Function:TURN ON CENTRAL HEATING (by turning on the Nest) Trigger : Target_Temp_room1 is changed PreExec : Check if I am home (if I'm Away do nothing) Action : check how much the Target_Temp_room1 is away from the FIBMOTION:current_temp_room1 (=Temp_Difference_room1) --> Set API:Nest_target to API:Nest_Current_Temp + Temp_Difference. Set the Thermostat to Target_Temp_room1 if it isn't already. Function:TURN OFF CENTRAL HEATING Trigger : Room Temperature has reached the Target_Temp Action : Set API:Nest_target to API:Nest_Current_Temp * https://forum.fibaro.com/index.php?/topic/22592-danfoss-valves-and-room-sensor-winter-is-upon-us https://forum.fibaro.com/index.php?/topic/21275-danfoss-lc-13-how-does-it-work http://www.vesternet.com/knowledgebase/technical/kb-7 https://forum.fibaro.com/index.php?/topic/21899-danfoss-thermostat https://forum.fibaro.com/index.php?/topic/22644-4100-danfos https://forum.fibaro.com/index.php?/topic/19782-thermostat-danfoss-lc13-versus-devolo-thermostat https://forum.fibaro.com/index.php?/topic/22981-nest-fibaro-z-wave-radiator-valves https://forum.fibaro.com/index.php?/topic/22466-nest-thermostat-v3-fibaro-plugin-not-updating-workaround-found
  23. Hello, I'm using a HC2 in my holiday home and would like to read-out some system-information by a API-call (for example /api/devices). The problem is that I can’t “reach” the HC locally by VPN or Port forwarding. Is ‘t possible to create a LUA-scene to ‘catch’ the API-json-output and send it by email and if so, are there any examples of this kind of LUA-scripts? With kind regards, John Claassens
  24. Playing around with my MagicMirror installation, for now i just run app in servermode only and to my iPad, no mirror installation yet. Installing was no rocket sience, just followed the instructions. Added a couple of modules to play around with, first one out was weather data from wunderground and then a module with name syslog. So together with MagicMirror and a scene in my HC2 i can send data to be shown in the syslog module, thats nice Here is the lua scene code (just my first draft) --[[ %% properties %% events %% globals yeasterdayKW test --]] -- USER SETTINGS -- MMip = '192.168.0.137' MMport = '8080' local trigger = fibaro:getSourceTrigger(); local daysoftheweek={"Söndag","Måndag","Tisdag","Onsdag","Torsdag","Fredag","Lördag"} local yesterday = urlencode(daysoftheweek[os.date("*t").wday-1]) function urlencode(str) if (str) then str = string.gsub(str, "\n", "\r\n") str = string.gsub(str, "([^%w ])", function (c) return string.format ("%%%02X", string.byte(c)) end) str = string.gsub (str, " ", "+") end return str end function MM(types,data) local function getMethod(requestUrl, successCallback, errorCallback) local http = net.HTTPClient() http:request(requestUrl, { options = { method = 'GET', headers = { }, }, success = successCallback, error = errorCallback }) end local url = 'http://'..MMip..':'..MMport..'/syslog?type='..types..'&message='..data getMethod(url, function(resp) print(resp.data) end, function(err) print('error' .. err) end ) end if (trigger['type'] == 'global') then if trigger['varName'] == 'yeasterdayKW' then MM('INFO',yesterday..'+'..fibaro:getGlobal(trigger['varName'])..'+'..'kWh') elseif trigger['varName'] == 'test' then MM('ERROR',fibaro:getGlobal(trigger['varName'])..'+'..'variabel') end elseif (trigger['type'] == 'other') then print('Scene started by other.') end
  25. Hi folks, I have a bit of a puzzler. I have a scene that sets to global variables based on light level from a sensor (device 217 ) The two options within the code are either 'day' or 'night' but sometimes it gets set to 'normal' Could anybody offer an explanation Scene code below... Thanks Frank --[[ %% autostart %% properties 217 value %% events %% globals --]] -- Configuration - Scene Info sceneName = "GV Time of Day, inside and outside" sceneVersion = "1.0.1" -- Scene Description -- Sets a global variable called TOD_LightMode depending on lux level from an outside sensor -- Configuration - Device IDs local OutsideLuxSensorID = 217 -- Validate Number of Scene Instance if (fibaro:countScenes()>1) then --fibaro:debug("stop scene") fibaro:abort() end function UpdateEventLog(eventStr) local currDate = (os.date("%b %d - %H:%M")) local updStr = (fibaro:getGlobal("Log_Event") .."".. currDate .." ".. eventStr .." \n") fibaro:setGlobal("Log_Event", updStr) end -- Main Code for the Scene function tempFunc() --set reference for outside lights if tonumber(fibaro:getValue(OutsideLuxSensorID, "value")) == 0 then fibaro:setGlobal("TOD_LightMode", "night") fibaro:debug("Outside = 0 - "..fibaro:getGlobal("TOD_LightMode")) UpdateEventLog("Outside mode set - night mode") else fibaro:setGlobal("TOD_LightMode", "day") fibaro:debug("Outside > 0 - "..fibaro:getGlobal("TOD_LightMode")) UpdateEventLog("Outside mode set - day mode") end fibaro:sleep(5000) fibaro:debug(fibaro:getValue(OutsideLuxSensorID, "value")) -- set refernce for inside lights if tonumber(fibaro:getValue(OutsideLuxSensorID, "value")) < 50 then fibaro:setGlobal("TODModeInside", "night") fibaro:debug("Inside <40 - "..fibaro:getGlobal("TODModeInside")) UpdateEventLog("Inside mode set - night") else fibaro:setGlobal("TODModeInside", "day") fibaro:debug("Inside >40 - "..fibaro:getGlobal("TODModeInside")) UpdateEventLog("Inside mode set - day") end fibaro:debug("Inside - "..fibaro:getGlobal("TODModeInside")) fibaro:debug("Outside - "..fibaro:getGlobal("TOD_LightMode")) end -- Trigger Management local currentDate = os.date("*t") local startSource = fibaro:getSourceTrigger() --Start of Scene Execution if (startSource["type"] == 'property') then fibaro:debug("Started through property") tempFunc() -- this is calling the the function if something happens. elseif (startSource["type"] == 'global') then fibaro:debug("Started through variable") tempFunc() -- this is calling the the function if something happens. elseif (startSource["type"] == "autostart") then fibaro:debug("Started through autostart") tempFunc() -- this is calling the the function if something happens. elseif (startSource["type"] == "other") then fibaro:debug("Scene not started, this can only be started through property, global or autostart!"); end -- End of Scene Execution fibaro:debug("Scene, " .. sceneName .. " v" .. sceneVersion .. " completed.")
×
×
  • Create New...