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

  • 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

Found 6 results

  1. Hi, I'm trying to create a QA/QD to get through APIs all my Philips Hue Data: Button 1: Get all Hue Groups Button 2: Get all Hue Scenes Button 3: Get all Hue Lights The purpose is to store this in a global variable and then be in a position to use this in other QD and scenes (saving light parameters for instance, to come back to initial state after an alert...or naming hue light in fibaro HC3 as they are in Philips hue environment...) I've managed to make it run, see code below, hope it could help some one... That's kind of a miracle considering my skills ^^ My issue starts where i actually do have 2 hue bridges (more than 50 lights). I would like to extract data from each of them and then merge result in a single table that I would then set as a global variable. This table should have one more key than the hue table: for the bridge source (1 or 2). I guess it's something with a for k,v in pairs(result) but i can't manage making it run To understand the code below: * to avoid having device id coded in scene and QA, they are all part of a Global Variable (mappingTable). If I want to change a device Id because replacing it, changing the Id in mappingTable updates all scenes and QA * i have coded only bridge 1. user information for bridge 2 are prepared * I've deleted all my attempts to present a running code if someone is interested Another question is around the function to get hue information in return. I'm not sure really understanding and mastering the synthax which remains a little bit obscur for me. could it be simpler? May I request some help and attention? Covid alert gives me sometime to search, but honestly, i'm stuck Thanks in advance for your support ^^ roomName = "SSLBUR" -- nom de la pièce cible floorName = "SSL" -- nom de l'étage de référence function QuickApp:globalVariable() self:debug("-- Chargement des variables globales nécessaires au QA") mappingTable=json.decode(tostring(fibaro.getGlobalVariable("mappingTable"))) end function QuickApp:hueConfigUpload() hueIP1 = mappingTable["SYSTEME"]["devices"]["hueBridge"]["hueBridge1"]["hueIP1"] huePort1 = mappingTable["SYSTEME"]["devices"]["hueBridge"]["hueBridge1"]["huePort1"] hueUser1 = mappingTable["SYSTEME"]["devices"]["hueBridge"]["hueBridge1"]["hueuser1"] hueIP2 = mappingTable["SYSTEME"]["devices"]["hueBridge"]["hueBridge2"]["hueIP2"] huePort2 = mappingTable["SYSTEME"]["devices"]["hueBridge"]["hueBridge2"]["huePort2"] hueUser2 = mappingTable["SYSTEME"]["devices"]["hueBridge"]["hueBridge2"]["hueuser2"] end function QuickApp:mappingHueGroup() self:globalVariable() self:hueConfigUpload() local address = "http://"..hueIP1.."/api/"..hueUser1.."/groups" self.http:request(address, { options = { headers = { Accept = "application/json"}, checkCertificate = true, method = 'GET' }, success = function(response) self:debug("response status:", response.status) self:debug("headers:", response.headers["Content-Type"]) fibaro.setGlobalVariable("mappingHueGroup", response.data) self:debug(response.data) local data = json.decode(response.data) self:debug(data["1"].name) end}) self:debug(mappingHueGroup) end function QuickApp:onInit() self:debug("") self:debug("-- Démarrage du code principal") self.http = net.HTTPClient({timeout=3000}) self:mappingHueGroup() -- self:mappingHueLight() -- self:mappingHueScene() end
  2. How to store a table in global variable ? I tried : --The table has predefined values: --lights2checkstatus[1] = 0 --lights2checkstatus[2] = 86 -- I copy local variable (1 dimensional table) to global variable : fibaro:setGlobal("LightsStatus", lights2checkstatus) --where lights2checkstatus is 1-dimension table (0,86). -- I copy global variable to local variable "lights2checkstatus1" : local lights2checkstatus1 = {} lights2checkstatus1 = fibaro:getGlobal("LightsStatus") -- I debug values of local variables "lights2checkstatus" and "lights2checkstatus1" : fibaro:debug(lights2checkstatus) fibaro:debug(lights2checkstatus1) -- The result of debug is eg. : table: 0x8731ca0 table: 0x8731ca0 Which means lights2checkstatus and lights2checkstatus1 are same. There was read from the global variable the same what was earlier written to it. But each time I rune the scene (with the same values of the table (0,86) ) I have different values : table: 0x8828500 table: 0x8828500 table: 0x93f6938 table: 0x93f6938 and so on ... What I do wrong ? How to store in a global variable a table , eg. my test table (0,86) ?
  3. Hi, I'm no fan of the build-in alarm in HC2 so I'd like to create my own scenes/VD's for this. . @Sankotronic is working on a very promising UHAS system but his plans are pushed out (no offence, he released real nice things already, I'm fan) so I decided to move on, writing some code myself with hopefully some help of you ;-)! What do I use in my alarm; > Lights (selected regular lights in the house to switch to 100% when alarm is breached) > Door/window sensors > PIRs > Sirenes (for acoustic alarm) > flashlight (for visual alarm) > RGBW led indicator (at the entrances to notify alarm is; just armed (leave the house indicator), armed (not safe to enter indicator), disarmed(safe to enter indicator) What do I want; > Fibaro remote keychains available to manually arm/disarm the alarm > All users have a IFTTT account on their phones to trigger a scene when entering/leaving home (geofence). This will set my global "guestmode". (bad exerience with Fibaro GPS) > When nobody is at home, the global "alarmmode" should set to "FullAlarm". At "FullAlarm" all PIRs and D/W's sensors are set to armed. (report error when not in safe state when arming). > When at night (Darkness) all users are at home and all PIR and D/W are safe for X time, "sleepstate" to be set "sleep" else "awake". > when at sleep, the "alarmmode" will switch to RingOnly. Only the D/W sensors will be armed (not PIR). When a PIR is breached the alarmmode will be set to disarmed state. When sleep state is reached again the alarmmode will switch back to RingOnly. > if armed and breached, the alarm is triggered. The sirenes and flashlight will start to run and all lights will be set to 100%. If all D/W and PIR are safe for X time, alarm to back to armed state and lights off. > if armed and breached, the timestamp of alarm will be logged. If alarm is disarmed after it was breached the notification LED will warn for this. > If I disarm the alarm, put all lights/DW in safe state. > Notifications via Pushover or even better, use the message hub of @autofrank with Fibaro PopUps and Push services. Unfortunately I currently have errors with the message hub. What is my current status. All code based on simple if/then LUA coding, no fancy loops. DONE: scene to check all PIRs Scene will set global variable DONE: scene to check D/W sensors. Scene will set global variable DONE: One scene to take care of the global sleepstate DONE: One scene to take care of the global guestmode DONE: a VD to manually set alarmstate and alarmmode. DONE: a VD to manually set guestmode todo: a mainalarm scene to arm/disarm the alarm (based on above algorithm) todo: an alarm scene to trigger the alarm when breached (or merge this in the mainalarm scene) todo: scene(s) for RGBW led indicators todo: scene(s) for the push notifications (Alarm breached, error (Eg door/window open when arming the alarm) I noticed that I get stuck with the remaining scenes. I'm no programmer, so I use mainly simple if/then LUA code. With a lot of scenes in the alarm you easily get lost. In an attempt to keep my coding cleaner/more condensed I want to use tables/json. I already use the Hometable but that's just a simple copy the instructions of @AutoFrank. Questions; For the remaining alarm scenes I have difficulties how to store a table in a global and even more how to use from a table. The tutorials on this topic are not clear to me yet. For example, when the alarm is breached, how to switch all lights to 100% for the device IDs in a global(table). I have seen examples of code like k,v in (i)pairs but I don't get it yet. Can somebody help me with some code examples? Any other suggestions on my ideas for an alarm? Thanks! Regards, Jules
  4. I like to initialize an empty table (like HomeTable) from a scene if it is not exist. I tried the simple following lua code but it fails. -- Check if variable exist if (fibaro:getGlobal(DDDTable) == nil) then fibaro:debug("Creating Variable Table "..varName) jsonDDD = { settings = { version='0.1' }, } jDDDTable = json.encode(jsonDDD) fibaro:setGlobal("DDDTable", jDDDTable) -- store table in global else fibaro:debug('Existing Variable') end It sounds crazy but I stuck on this point for 2 days...and my Bosch/Siemens Home-Connect project (I will share it with you guys) is on halt due to this **small** detail. Any help is more than welcome! P.S. @10der I know that you help people (high appreciate, thank you) like me on first steps... what a fool....! here is the code: api.post("/globalVariables", { name="testTable", value="Table", -- optional }) -- Modify existing variable to "predefined" style api.put("/globalVariables/testTable", { name="testTable", value="Table", -- optional isEnum=true, enumValues= { "Table", } }) here is the source: Another question is howto check if a variable is a table or something gone wrong during writing (human interaction).
  5. Hello I try to set value to table, but unfortunately is not work. The code is: Temp = fibaro:getGlobalValue("Sensor"); fibaro:debug(Temp); tempsen[7]= tonumber(Temp); fibaro:debug(fibaro:getValue(tempsen[7], "value")); The result is: Temp = 20 but temp[7] = nil How i can set it properly ?
  6. Hi2UAll, I need some help. I'm able to store a table in global variable and read the content. But.. When saving is done, by a webbrowser in the HC2 global variable panel, the data is corrupted! The value in the global variable shows NaN (Not a Number). Before saving a table in a global variable in lua I encoded it first. When reading the global variable I use decode. ( json.decode(MYTABLE) ) Can somebody help me with this to get it right? Thank in advance!
×
×
  • Create New...