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 'vd'.

  • 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. I was trying to find workaround here but without success. So I request for a new feature. Possibility to break line in labels of VD on all devices (web UI, iOS mobile, Android mobile) in one common way. Actually: web UI supports html tag <br/>, but mobile not (mobile displays tag as <br/>) iOS supports \n Android doesn't support <br/> nor \n Solution can be done in 2 ways: a) support <br/> tag on iOS and Android mobile or b) support \n on webUI and Android Examples how line breaking looks like actually: web UI iOS mobile Android mobile
  2. Hi I'm trying to break line in VD label. Do you have a solution for this? My VD has got 3 labels: Label 1: line 1<br/>line 2 Label 2: line 1\nline 2 Label 3: line 1<br/>\nline 2 Label 1 looks good on www but not on iOS mobile. Label 2 looks good on iOS mobile but not on www. Label 3 looks good on www but not on iOS mobile. Every of these 3 labels looks bad on Android mobile. www mobile iOS mobile Android My VD: Line_Break.vfib
  3. Hi all, Is it possible to create a "tapable" virtual device? Meaning that - for example like the Fibaro plug - when you tap it it can execute some LUA code? What I want to do is quite simple: I have automatic lights in the bathroom, which is great. However, sometimes I want to take a bath and I do a) not want the lights to turn off automatically and b) set the lights to the lowest setting. I know how to achieve this in LUA, however I want to have a VD that I just tap to turn it on and off and perhaps change the icon while I'm at it. Is this possible? Thank you for your help, much appreciated. KR, Kristof
  4. Hey Guys, Trying to send a HTTP String from my HCL VD but it's not working.. anyone see what I'm doing wrong, String I'm trying to send is: GET https://api.thingspeak.com/update?api_key=MYKEY&field1=
  5. hi, I made this VD a while ago. It makes a weekly report of the HC2 and works pretty good but I want to move in to a scene. I used Net.FHttp and this doesnt work in scenes. Can somebody help? Regards Martijn --- UPDATE MEMORY VARIABLES fibaro:call(fibaro:getSelfId(), "pressButton", "8") --- MAKE CONNECTION connection = Net.FHttp("127.0.0.1", 11111); --- FUNCTION REQUEST DEVICES getData = function() --- MAKE CONNECTION response ,status, errorCode = connection:GET( "/api/devices/" ); --- STATUS NOTIFICATIONS fibaro:debug("status = " .. status); fibaro:debug("errorCode = " .. errorCode); --- IF SUCCES if (tonumber(status) == 200) then --- DECODE TO LUA TABLE deviceTable = json.decode(response); end return deviceTable; end --- FUNCTION REQUEST CONSUMPTION getConsumption = function(url) --- MAKE CONNECTION response ,status, errorCode = connection:GET( url ); --- IF SUCCES if (tonumber(status) == 200) then consumptionTable = json.decode(response); end return consumptionTable; end --- CONSTRUCT SUBSTRACTION DAYS START DATE OF LAST WEEK if(os.date("%a") == "Mon") then substract = 7 elseif(os.date("%a") == "Tue") then substract = 8 elseif(os.date("%a") == "Wed") then substract = 9 elseif(os.date("%a") == "Thu") then substract = 10 elseif(os.date("%a") == "Fri") then substract = 11 elseif(os.date("%a") == "Sat") then substract = 12 elseif(os.date("%a") == "Sun") then substract = 13 end --- SET VARIABLES UserId = 2; lowBat = 70; SelfId = fibaro:getSelfId() dev = getData(); lowBattDevices = ""; deadDevices = ""; totalConsumption= 0 ; heavyConsumption= ""; now = os.date("*t") week_start = os.time({year=now.year,month=now.month,day=now.day-substract,hour=0,min=0,sec=0}) --, week_end = week_start + 604799 -- plus a week --- LOOP THROUGH DEVICES for i = 1, #dev do --- SET VARS batLevel = tonumber(dev.properties.batteryLevel); deadValue = dev.properties.dead; deviceName = tostring(dev.name); prestr = "[" .. dev.id .. "] ➜ " .. deviceName; --- DEAD DEVICES if(dev.visible == true and deadValue == "true") then --- TRY TO WAKE fibaro:wakeUpDeadDevice(dev.id) fibaro:sleep(2*1000); --- CHECK IF STILL DEAD if(fibaro:getValue(dev.id, 'dead') ~= "1") then deadDevices = deadDevices .. prestr .. " ✔ Woke up \n"; else deadDevices = deadDevices .. prestr .. " ❌ Did not wake up \n"; end end --- LOW BATT / IF FIELD EXISTS if (dev.visible == true and dev.properties.batteryLevel ~= nil and (batLevel < 100 or batLevel == 255)) then --- ONLY LOW BAT OF ALLREADYDEAD if(deadValue == "true" or batLevel <= lowBat or (deadValue ~= "true" and batLevel == 255)) then -- lowBattDevices = lowBattDevices .. prestr .. " - " .. string.format('<%s style="color:%s;">%s</%s>', "span", "red", dev.properties.batteryLevel .. " %", "span") .. "<br>\n" lowBattDevices = lowBattDevices .. prestr .. " - " .. dev.properties.batteryLevel .. "% ❌ \n" else lowBattDevices = lowBattDevices .. prestr .. " - " .. dev.properties.batteryLevel .. "% ✔ \n" end end --- CONSUMPTION if (dev.visible == true) then --- SET VARS url = "/api/energy/" .. week_start .."/" .. week_end .. "/compare/devices/power/" .. dev.id Consumption = getConsumption(url); --- ONLY IF THERE IS A KWH FIELD if(Consumption[1].kWh ~= nil) then --- SET VARS kwh = tonumber(Consumption[1].kWh) --- HEAVY USERS LOOP if kwh > 1 then heavyConsumption = heavyConsumption .. prestr .. " ⚡ " .. Consumption[1].kWh .. " kWh \r"; end --- TOTAL CONSUMPTION SUM totalConsumption = tonumber(totalConsumption) + kwh end end end --- CONSTRUCT MAIL HOME REPORT emailContent = "Weekly Home Report \n"; emailContent = emailContent .. "Date: " .. os.date("%d %b %Y - %H:%M") .. "\n \n"; emailContent = emailContent .. "⎋ Low Battery\r"; emailContent = emailContent .. lowBattDevices .. "\r \r"; emailContent = emailContent .. "⎋ Dead Nodes\n"; emailContent = emailContent .. deadDevices .. "\n \n"; --- SEND MAIL fibaro:call(UserId,"sendEmail", "Weekly Home Report " .. os.date("%d %b %Y - %H:%M"),emailContent); --- CONSTRUCT MAIL CONSUMPTION REPORT emailContentConsumption = "Weekly Consumption Report \n"; emailContentConsumption = emailContentConsumption .. "Date: " .. os.date("%d %b %Y - %H:%M") .. "\n \n"; emailContentConsumption = emailContentConsumption .. "⌘ Consumption\n"; emailContentConsumption = emailContentConsumption .. "From: " .. os.date("%d %b %Y",week_start) .. " till " .. os.date("%d %b %Y",week_end) .. "\n \n"; emailContentConsumption = emailContentConsumption .. "Heavy consumption \n"; emailContentConsumption = emailContentConsumption .. heavyConsumption .. "\n\n"; emailContentConsumption = emailContentConsumption .. "Consumption total\n"; emailContentConsumption = emailContentConsumption .. totalConsumption .. " kWh \n\n"; --- SEND MAIL fibaro:call(UserId,"sendEmail", "Weekly Consumption Report " .. os.date("%d %b %Y - %H:%M"),emailContentConsumption); --- CONSTRUCT MAIL CONSUMPTION REPORT emailContentMemory = "Weekly Memory Report \n"; emailContentMemory = emailContentMemory .. "Date: " .. os.date("%d %b %Y - %H:%M") .. "\n \n"; emailContentMemory = emailContentMemory .. "⌽ Memory\n"; emailContentMemory = emailContentMemory .. "➜ Free memory: " ..fibaro:getValue(SelfId, "ui.labFreeRam.value") .. "\n"; emailContentMemory = emailContentMemory .. "➜ Maximum free: " ..fibaro:getValue(SelfId, "ui.labMax.value") .. "\n"; emailContentMemory = emailContentMemory .. "➜ Minimum free: " ..fibaro:getValue(SelfId, "ui.labMini.value") .. "\n"; emailContentMemory = emailContentMemory .. "➜ Memory Cache: " ..fibaro:getValue(SelfId, "ui.labCache.value") .. "\n"; emailContentMemory = emailContentMemory .. "➜ Memory Buffers: " ..fibaro:getValue(SelfId, "ui.labBuffers.value") .. "\n"; emailContentMemory = emailContentMemory .. "➜ Memory Used: " ..fibaro:getValue(SelfId, "ui.labUsed.value") .. "\n"; emailContentMemory = emailContentMemory .. "➜ Storage: " ..fibaro:getValue(SelfId, "ui.labStorage.value") .. "\n"; --- SEND MAIL fibaro:call(UserId,"sendEmail", "Weekly Memory Report " .. os.date("%d %b %Y - %H:%M"),emailContentMemory);
  6. Hello everyone, I have this code local myDeviceID = fibaro:getSelfId() local value1 = fibaro:getGlobal('bg_ramendeuren') fibaro:call(myDeviceID, "setProperty", "ui.Label1.value", value1) if value1 == "Open" then fibaro:call(744, "SetProperty", "currentIcon", 1008) else fibaro:call(744, "SetProperty", "currentIcon", 1010) end But what I want it to do (change the icon based on the global variable) doesn't work and I have no idea what's wrong. The code is running within the "main loop" section of a virtual device. the virtual device only has one label, no buttons. debugging the main loop gives no errors. Hope someone can help me out here.... Greetings, Vincent
  7. Hi. I have a fibaro HC Lite and have recently bought a Sonos Play:1. I would like to use the double click of my kitchen light switch to 'play' the speaker and then again to pause it.I've installed the plugin and have it working but I cannot see the device when in the graphical blocks scene builder, nor is it showing as a virtual device.I also tried to get the hcl virtual device to import but it just kept on saying doesn't support LUA code. Even though it was the specific home centre lite virtual device control plugin from the fibaro website.What am I doing wrong? Any advice would be greatly appreciated as I only bought the play:1 as it works with FibaroCheers,Steve
  8. pablo77

    MQTT

    Witam, Oto opis sytuacji: mam czujnik temperatury, wilgotności, ruchu oraz natężenia światła. Całość działa pod kodowaniem arduino. Informacje z czujki są wysyłane do serwera mqtt (CloudMQTT). Wygląda to tak na serwerze mqtt: sensornode_2{"state":"OFF","color":{"r":255,"g":255,"b":255},"brightness":255,"humidity":"45.90","motion":"standby","ldr":"903","temperature":"31.40","heatIndex":"26.40"} sensornode_1{"state":"OFF","color":{"r":255,"g":255,"b":255},"brightness":255,"humidity":"48.80","motion":"standby","ldr":"816","temperature":"31.10","heatIndex":"26.20"} Czy da się to przenieść na HC2 jako VD ?? Będę wdzięczny za pomoc.
  9. Hello, I've some of my automatic Somfy automatic curtains connected with a Rollershutter 2. Now i would like to create a Virtual Device with 3 buttons ('Open' , 'Half' and 'Close') and a slider to manage these curtains Is some having a kind of VD for this already of can somebody me give some examples how to create a VD like tis? Thank you in advance! John.
  10. HI I am running 4.134 (just updated issue was in 4.133) I have a very simple VD to change a variable Variable is "Position" VD Below PUT /api/globalVariables/Position HTTP/1.1 Host: 127.0.0.1 Authorization: Basic a2VsdmluQHN1ZHMzMi5jby5uejp######## admin user and password (in my case admin is email address) {"name":"Position","value":"Home"} And PUT /api/globalVariables/Position HTTP/1.1 Host: 127.0.0.1 Authorization: Basic a2VsdmluQHN1ZHMzMi5jby########## {"name":"Position","value":"Out"} Screen shots attached. Basically it does not work anymore but I can't work out why, I have other VD's that have stopped working but the Reboot one works fine
  11. Hello, Here is site with earthquake sensors. Any one tried to create VD with these sensors ?? http://quakecatcher.net/qcn-map With regards, pablo77
  12. Hi, Is this is new bug or a feature for a while If I try and create a label ID with a _ it reverts back to the preset label even though the preset ID has an _ Take VD label... change the ID and click save and the label ID reverts back trying the with a simpler ID with no underscore and success... new bug, old bug or just the way it is ? Thanks
  13. Hi, I'm new to HC2 and getting HC2 to know little by little. I have a VD to control my airco. I have three buttons, Power toggle, Power on and Power off. I have Power on and Power off working. I use LUA for all three buttons. Is it possible to control the Power on and Power off buttons from the Power toggle button? If Yes, could someone please provide me with some sample code? Thanks, FJW.
  14. hi friends! want to do virtual console TVSAT on the Fibaro Lite. For a start, the two buttons on/off Tell me what has to be done in line fibaro:call(id, "setThermostatSetpoint", "", "") below this button included 12 value programmed by me 25 parameter? and what tick to deliver, and which are not? Please send me a screenshot of who is able to configure. not working please help
  15. Hopefully a straight forward question with a straightforward answer. is it possible to make a VD show under a device type? For example I have a VD which controls a light, simple on and off VD. It doesn't however show under lighting devices. Can it be made to show under lighting with some extra code or something? Thanks for any information you can offer!
  16. Hi @CelticWebs I've attached the gate and garage VD's I use but didn't strip out any parts as discussed. Some comments to help as you pick through the code Garage I use the sonos-api for music control. The IP and Port that are set i the vd are for the api (XX.89, port 5005) all the jT references are for the Hometable global variable In the main loop i check status of /fibaro:getGlobal("G_SPC_ZONE_INPUT_7")/. This is my garage door sensor, it looks different because it is part of my siemens alarm whose status is mirrored in my HC2 the garage all off doesn't close the door - I'll be adding that soon Full vd looks as follows Gate My gate just requires a zero volt contacts close to either open or close so I have the relay set to 'auto-off' after 2 seconds and this is enough to trigger it If I leave the relay open it will hold the gate open The button options are standard enough, nothing different here in the Main loop I use a global variable called stateTable. I use the table to check for changing states at parts of my setup When the gate pen I want to take a photo but as the vd loop runs (constantly - every 3 seconds) I don't want an endless stream of pics if left open. To prevent this I write the status to the state table and what it next changes state I compare before setting the new state. This gives me one trigger point to take the one picture -- code to write the state table jS.driveway.gateState = 0 jSonosTable = json.encode(jS) fibaro:setGlobal("StateTable", jSonosTable) This sets the icon fibaro:call(device, "setProperty", "currentIcon", 1954) The rest should be easy enough to pick through Please come back with any questions as it can be difficult sometimes to pick through some other persons code -f Garage_Control(1).vfib Gate_Control(1).vfib
  17. I was starting to read thru and try the docs as available on my HCL (IP Address/docs). So I created a variable to try. I tried the PUT command and it all works like a charm after some trial and error. But how do I translate this into a string to be used e.g. for a button in a virtual device? the docs subpage provides no clue about this. Currently I have given up as it is just trial and error without having a clue what is wrong. It would be incredible helpful if the docs page would show the string as well in the format it has to be put into the VD String section. It would definitely help beginners like me
  18. Hello everyone! I'm working on solution that should bring easier sharing and installation of scenes and virtual devices for users. What I'm missing is a way how to change button and label 'Name' or 'caption' using LUA code and/or REST API. See picture bellow: @T.Konopka, Please if you know answer to this question can you share it, or of it is not possible with latest version 4.120 can this be added to the todo list for some future release? Really appreciate your help! Sincerely Sankotronic EDIT This is solution to the question provided by @A.Socha: --id of VD id = 105 --contecting to HC2 to get VD who you want modify local HC2 = Net.FHttp("127.0.0.1", 11111) payload = "/api/virtualDevices/" .. id response, status, errorCode = HC2:GET(payload) if tonumber(errorCode) == 0 and tonumber(status) == 200 and response ~= nil and response ~= "" then jsonTable = json.decode(response) --changening caption jsonTable.properties.rows[1].elements[1].caption="testazz" --sending it back local response, status, errorCode = HC2:PUT(payload, json.encode(jsonTable)) end After changing label, slider or button caption please refresh HC web GUI interface page and do Refresh Network data on mobile devices to make change visible!
  19. [VD] HC2 Icon preview v2.1 Dear Fibaro friends! As you know, the worst part of importing and setting up virtual devices is finding icons ID's. How many times you noticed my VD's here with beautiful icons , but when you imported it all beauty is gone and there is just that ugly, blue box And then even when you manage to import those beautiful icons of mine then what? In code you have to setup some iconID but where to find that? Well, the time finally came to put us all to the end of that misery!!! Here it is, HC2 Icon Preview VD in its glory: This latest version can be found here for download: Enjoy coding!
  20. Hello ALL, as a newbee and beginner in LUA, I'm trying to build a VD for my Logitech Squeezebox Touch, where i have a slider to set the volume and also 2 buttons to increase and decrease the volume. Now I don't know how to move the slider by software, when i in- and decrease the volume by the buttons. Anybody an useful idea? Thanks in advance.
  21. Hi. I have a short question: I use several virtual devices and to control my home. I use Android tablets, Android phones and also iPhones and iPads. My problem is, that the font size of the VD on all iOS devices (iPhone, iPad) is extremely large, so I have to scroll within the VDs to see all buttons. On Android devices (tablet and phones), the font size is perfect. Is there any possibility to configure the font size for iOS devices? Thanks, Torsten
  22. Updated Aug 2018 Now that my setup is reaching an amount of stability and it is getting to where I want it I decided I would update my setup post and also structure it a bit better. The core of my automation system if I exclude all the AV equipment is as follows HC2 runnnig 4.18. Approximately 102 z-wave devices and about 20 Sonoff wifi devices running Tasmota RPi running sonos http-api and HA Bridge, RPi running Unifgi Controller, RPI running octpprint fro 3d printer control, SPC Gateway for Siemens Alarm integration 4 IP cameras, 6 Echo Dots, 14 sonos zones, GC-100-12 for IR control over all media devices (TV, Media Sources, Projector,, etc), HDMI Matrix Automatic Dust collection system in garage (3d printed blast gates, limits switches with wemos D1 mini monitoring inputs and smart control switching of vacuum system) Room setup I have the usual rooms across ground floor, first floor, garage and outside I also have a section called System with the following rooms where i have all my scenes and VD's (more details on this below) Control – manual control of house stuff, Settings – Where I can tweak the automation, Status – display various system status stuff, Automation – only used by other scenes/VD, Alexa – only used by Alexa Development – stuff I’m working on Critical Scenes and VD’s Main Scene – master scheduler & Hometable – used to track id’s of scenesm, VD’s and devices and custom icons Timers + Sunset/Sunrise + weather courtesy of Sankotronic SCVD Watchdog scene - monitors for error or stopped VD and restarts them, monitors for specific debug messages and clears them if required Smart message Hub – used for main events that I want to know happen (alarm on/off, house modes, etc) Multiple Data Loggers – used for background tasks that I can check if I need to (keep clutter out of message Hub) Network device Monitors & State Table to track network devices status and system state information Lights in critical areas are automated as well as music and media, the rest is manual when needed. House modes can override automated settings (entertain mode changes behavior of garden, patios, bbq area lights) Some of what I have running is... Morning audio greeting in our bedroom and the kids bedroom, weather, temp in house, time, etc (our alarm clock!) 2. After greeting it groups players, selects a radio station, checks if it's available and if not selects another one Starting music in the kids bedrooms for night time. I also check periodically if the radio station available and restarts the radio station or selects another one if not available. Announcements for when fridges or freezers go over temp One button click for night, welcome back, leaving home (music, lights, TV, music adjustment + audible greeting ( time and temp of house on arrival) open zones on leaving, Zone Inihibit leaving and night options if windows are left open TV switch on in the playroom switches off the music, camera snapshops of front gates when they are opened/close Use of MP3 clips that systems uses instead of Polly TTS if internet is offline ... and the list goes on System Overview
  23. Hi everyone, I'm having some issues with Lua code in a virtual device I am writing. I'm getting information on the status of my Bluespray irrigation controller. It has a basic API and reports if any of the zones are on watering. I want to just query the unit and then print out if any are detected as on. When I query bluespray controller and its not watering anything I get some JSON back which looks like this. { "result": { "sensors": { "door": 0, "rain": 1 }, "active_zones": [ ], "timestr": "Sat Mar 11 2017 10:09:38 PM", "time": 1489241378000, "door": 0 }, "id": 528452 } When its IS watering I get the following. { "result": { "sensors": { "door": 0, "rain": 1 }, "active_zones": [ { "on": 1489240754, "off": 1489241054, "run": 1489240754, "terminal": 3 } ], "timestr": "Sat Mar 11 2017 10:00:12 PM", "time": 1489240812000, "door": 0 }, "id": 218829 } To make it even more complex sometimes the system reports multiple zones operating. (This is normal and ok. I just need to pick up the first zone reported) { "result": { "sensors": { "door": 0, "rain": 1 }, "active_zones": [ { "on": 1489241854, "off": 1489241974, "run": 1489241854, "terminal": 4 }, { "on": 1489241854, "off": 1489241974, "run": 1489241854, "terminal": 8 } ], "timestr": "Sat Mar 11 2017 10:17:38 PM", "time": 1489241858000, "door": 0 }, "id": 998161 } My issue is detecting if I get none, one or multiple active zones. If I have a valid zone then I then want to put the first zone number into the zoneterminal variable. If I don't have a valid zone I just want to put 0 into the zoneterminal variable. The problem is when I try something like the code below I get [ERROR] 22:11:22: line 56: attempt to index field '?' (a nil value) I cant figure out how to deal with LUA arrays correctly. (specifically detecting valid entries) The json.null operator does not seem to work the same way on array values. -- This script polls data from a local Bluespray Irrigation controller every 60 seconds and displays the status of the active zones -- Its configured for a speicific system but could easily be adapted to any bluespray controller. -- This script is written for Fibaro HC2 -- Script written by Brom ([email protected]) -- version 0.1 (10/3/17) function round(x, n) n = math.pow(10, n or 0) x = x * n if x >= 0 then x = math.floor(x + 0.5) else x = math.ceil(x - 0.5) end return x / n end fdata = {} zonename_1 = "Front Lawn" zonename_2 = "Road Lawn" zonename_3 = "Front Garden" zonename_4 = "Back Lawn Left" zonename_7 = "Back Lawn Right" zonename_5 = "Back Garden Left" zonename_6 = "Back Garden Right" fdata.selfId = fibaro:getSelfId() fdata.selfIp = fibaro:get(fdata.selfId, "IPAddress"); -- Perform the grab from the irrigation controller. local irrigationcontroller= Net.FHttp(fdata.selfIp); response,status,errorCode = irrigationcontroller:GET("/api/status") -- Basic debugging fibaro:debug(response) -- Check the respose from the controller is valid and Pull out the details from the JSON response. if (tonumber(status)==200 and tonumber(errorCode)==0) then local irrigation = json.decode(response) -- If any of the responses are null then make them 0 if irrigation.result.time == json.null then polltime = 0 else polltime = irrigation.result.time end -- this bit does not work !!!! zoneterminal = irrigation.result.active_zones[1].terminal zoneon = irrigation.result.active_zones[1].on zoneoff = irrigation.result.active_zones[1].off zonerun = irrigation.result.active_zones[1].run -- Basic Debugging fibaro:debug("polltime: "..polltime) fibaro:debug("zoneterminal: "..zoneterminal) fibaro:debug("zoneon: "..zoneon) fibaro:debug("zoneoff: "..zoneoff) fibaro:debug("zonerun: "..zonerun) timeleft = (zoneoff - zonerun) / 2 / 60 fibaro:debug("timeleft: "..timeleft) -- Output to the device. if zoneterminal == 0 then fibaro:call(fdata.selfId, "setProperty", "ui.watering.value"," OFF ") end if zoneterminal == 1 then fibaro:call(fdata.selfId, "setProperty", "ui.watering.value"," ON "..zonename_1) fibaro:log("Time Left "..timeleft.." Min"); end if zoneterminal == 2 then fibaro:call(fdata.selfId, "setProperty", "ui.watering.value"," ON "..zonename_2) fibaro:log("Time Left "..timeleft.." Min"); end if zoneterminal == 3 then fibaro:call(fdata.selfId, "setProperty", "ui.watering.value"," ON "..zonename_3) fibaro:log("Time Left "..timeleft.." Min"); end if zoneterminal == 4 then fibaro:call(fdata.selfId, "setProperty", "ui.watering.value"," ON "..zonename_4) fibaro:log("Time Left "..timeleft.." Min"); end if zoneterminal == 5 then fibaro:call(fdata.selfId, "setProperty", "ui.watering.value"," ON "..zonename_5) fibaro:log("Time Left "..timeleft.." Min"); end if zoneterminal == 6 then fibaro:call(fdata.selfId, "setProperty", "ui.watering.value"," ON "..zonename_6) fibaro:log("Time Left "..timeleft.." Min"); end if zoneterminal == 7 then fibaro:call(fdata.selfId, "setProperty", "ui.watering.value"," ON "..zonename_7) fibaro:log("Time Left "..timeleft.." Min"); end if zoneterminal == 0 or zoneterminal == 1 or zoneterminal == 2 or zoneterminal == 3 or zoneterminal == 4 or zoneterminal == 5 or zoneterminal == 6 or zoneterminal == 7 then fibaro:debug("Valid Zone") else fibaro:call(fdata.selfId, "setProperty", "ui.watering.value","Error") end else fibaro:debug("error Irrigation Controller: "..errorCode) end -- sleep for 1 min fibaro:sleep(10000) -- fibaro:sleep(60000) Any help appreciated. ps Code for the output is really extra long. Looking to understand how I can manipulate the variable name / number I am outputting to reduce the number of if statements. Once I get this figured out I plan to also add in buttons to perform manual runs. Brom
  24. Hi, Enyone who can help me turn my Sony reciever str-DN1050 ON/OFF trough HC2 ? Nothing fancy, just an VD for ON/OFF and maybe input source an volume... Is this possible? Cant find anything....
  25. ZXT-120 is an IR extender for air conditioners, but it can be learned up to 20 defferent ir code for multimedia. The process of learning of zxt-120 is written in its manual, but i want to show a way to use that codes in fibaro HC. For this purpose we have to make a virtual device, and fill its IP Address with your HC ip, and write 80 in TCP port box: Then make buttons according to your multimedia device: Now you have to write commands for corresponding buttons. For example for first button: We can learn up to 20 code according to this list: Use this command for changing mode : /api/callAction?deviceID=107&name=setMode&arg1=0 For setting temperature (in cooling mode): /api/callAction?deviceID=107&name=setThermostatSetpoint&arg1=2&arg2=23 For setting temperature (in heating mode): /api/callAction?deviceID=107&name=setThermostatSetpoint&arg1=1&arg2=21
×
×
  • Create New...