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


Recommended Posts

Posted
On 4/28/2019 at 8:50 AM, jompa68 said:

I can recommend run Proxmox VE , it is a open source virtualization platform. I have setup 3 different linux containers with different purposes, one of the containers is where i have installed node-red.

 

Please login or register to see this link.

 

I run backup every night to my nas so it easy to recover if needed.

 

 

Hi jompa 68,

Please correct me if I am wrong.

As far as I have my selves informed if I want Proxmox I must install it over the top of Boops on the Raspberry Pi?

In the manual is written min 2 GB mem and harddrive, my PI does not have that

After that I must install node red, telegrambot, Sonospolly (AWS) and all other neat stuff to use on home automation.

My Pi will come  in a few days

Please advice

Posted
On 5/11/2019 at 7:34 PM, Sjakie said:

Hi jompa 68,

Please correct me if I am wrong.

As far as I have my selves informed if I want Proxmox I must install it over the top of Boops on the Raspberry Pi?

In the manual is written min 2 GB mem and harddrive, my PI does not have that

After that I must install node red, telegrambot, Sonospolly (AWS) and all other neat stuff to use on home automation.

My Pi will come  in a few days

Please advice

Proxmox does not support ARM processor, so no support for rPi.

I using Proxmox on a small desktop PC with 8GB of memory.

  • Topic Author
  • Posted

    New version, v2.0, fixB42 pushed to GitHub 

    Fix problem with sunset hour/sunrise hour being a day off due to HC2 delay to update values.

    Now ER does its own calculation and patches fibaro:getValue(1,"sunsetHour") etc to get the right values from 00:00:00...

     

    • Like 1
    Posted

    Thanks for the update!

    Is it system wise good or bad to have in each scene my whole list of devices listed?

    Please advice

  • Topic Author
  • Posted
    17 minutes ago, Sjakie said:

    Thanks for the update!

    Is it system wise good or bad to have in each scene my whole list of devices listed?

    Please advice

     

    You mean in the scene header

    --[[

    %% properties

    ...

    --]]

     

    or just declarations of the variables?

    I the latter case I would recommend you to start to store your deviceIDs in a Lua table.

    You get a couple of advantages with that;

    -You can declare the table once in one of the scenes and store it in a Fibaro global for use in other scenes

    -You can register it with ER to get the names of the variables printed in the logs

    Posted
    2 minutes ago, jgab said:

     

    You mean in the scene header

    --[[

    %% properties

    ...

    --]]

     

    or just declarations of the variables?

    I the latter case I would recommend you to start to store your deviceIDs in a Lua table.

    You get a couple of advantages with that;

    -You can declare the table once in one of the scenes and store it in a Fibaro global for use in other scenes

    -You can register it with ER to get the names of the variables printed in the logs

    okay great but your answer gives me more questions.

    Yes in the header.

    Is it possible to use "home table" for that, my device names are almost one on one  but that is easily to fix??

    Lua table?>>> all devices listed in a lua scene?

    How to store in GV

    How to register in ER

    Sorry for all these questions

  • Topic Author
  • Posted
    5 hours ago, Sjakie said:

    okay great but your answer gives me more questions.

    Yes in the header.

    Is it possible to use "home table" for that, my device names are almost one on one  but that is easily to fix??

    Lua table?>>> all devices listed in a lua scene?

    How to store in GV

    How to register in ER

    Sorry for all these questions

     

    Can you PM (private message) me your scene and I can have a look at it? Maybe I can derive some general recommendations for users of ER.

    Posted

    Oh sorry did not noticed this message I was very busy to implement. Yep will do but at first again thank you very much for pointing me out in the  right direction.

    I found a great guide line from AutoFrank @ creating HomeTable and what else to do>>>>thank you very much too!!!.

    Creating a new HomeTable and the scene described in AutoFrank @ guide lines and added the scene numbers.

    I put in on one file the reference to the HomeTable and face now that the scene does  not work containing an error on rule 9 so I will try to solve that first.

    If finished the job and will pm you, thanks.

  • Topic Author
  • Posted
    9 hours ago, Sjakie said:

    Oh sorry did not noticed this message I was very busy to implement. Yep will do but at first again thank you very much for pointing me out in the  right direction.

    I found a great guide line from AutoFrank @ creating HomeTable and what else to do>>>>thank you very much too!!!.

    Creating a new HomeTable and the scene described in AutoFrank @ guide lines and added the scene numbers.

    I put in on one file the reference to the HomeTable and face now that the scene does  not work containing an error on rule 9 so I will try to solve that first.

    If finished the job and will pm you, thanks.

     

    Ok, let me outline how "HomeTables" fit into the ER model.

    First, you may have read that you can't use variable names in the scene header, you need to use the device ID's number values. That's why you see scenes like

    Please login or register to see this code.

    It would be nice if we could use variable names in the header (or device names) but that's how it is.

    Anyway, in our scene code we want to use variable names instead of numbers when referencing devices in our rules or fibaro:* calls. So we declare 'sensor' and 'lamp' like in the example above.

    The home table idea is that we put all these deviceID values in a Lua table.

    Please login or register to see this code.

    What we call the hometable is not important, here we called it "HT". We can reference our sensor and lamp as HT.sensor and HT.lamp in the code.

    Here is the deal.

    <<<<< In ER rules we can only reference global Lua variables. >>>>>>>

    This is not fibaro's global variables but Lua's global variables. There are two ways to declare a variable in Lua

    Please login or register to see this code.

    Global Lua variables are accessible throughout the scene, local Lua variables are only accessible within the scope they are declared. So a local Lua variable declared within a Lua function is only valid within that function/scope. A local Lua variable declared on the top level of a scene (i.e. in the beginning of a scene) more or less behaves as a global Lua variable as its scope is the whole scene (there are internal differences, local Lua variables are faster to access).

    However, ER can only use global Lua variables inside rules. The reason is that the Lua sandbox we have in the HC2 allows for Lua code to find and reference global Lua variables (through _ENV) but not local Lua variables.

    So this will not work

    Please login or register to see this code.

    If we don't declare HT and lamp2 local it will work.

     

    It's a good practice to avoid global Lua variables as you can get unintentional conflicts if you use the same variable names in many places in the code (that's why global Lua variables tend to be long and complicated and maybe in all upper case), and there is also a small performance penalty.

    So, how do we get variable names into our ER rules then?

    Please login or register to see this code.

    We give our hometable to the Util.defvars() function. The difference now is that we don't have give the prefix 'HT.' when referencing the variables in ER rules.

    The reason is of course that the function gets  Util.defvars({sensor = 77, lamp = 66}), and it has no idea it came from a variable named HT....

    But it records that 'lamp' is 77 and 'sensor' is 66 and we can use these names in our ER rules.

     

    The other advantage with a hometable is that we can impose a structure on our variables, like what rooms deviceIDs are located in. We do that by nesting Lua tables.

    Please login or register to see this code.

    Util.defvars can cope with that and we can reference the variables with the "path" they have in our hometable. kitchen.lamp is different from bedroom.lamp and we don't have do come up with unique names for all lamps. (if we have 2 lamps in the same bedroom they need to have different names so that we can distinguish them, like bedroom.lamp1 and bedroom.lamp2 or some more creative naming).

     

    Another trick if we have a hometable is that we can tell ER to use the variable names when logging fibaro:* calls. 

    When we do a rule action like Rule.eval("kitchen.lamp:on"), ER normally logs the fibaro call that it results in, like

    Please login or register to see this code.

    If we in addition to Util.defvars do Util.reverseMapDef()

    Please login or register to see this code.

    ER will log the command as

    Please login or register to see this code.

    which is easier to read than just seeing the number 99 and trying to remember  what device that was.

     

    Ok, next. 

    If we have a scene were we have declared the hometable like above, we can store it in a fibaro global variable so that other scenes can pick up the same table without having to declare it again.

    In our first scene we store it in a fibaro global

    Please login or register to see this code.

    and in our other scenes we can just fetch the hometable from that global and use it

    Please login or register to see this code.

    When a deviceID changes because we remove and add a device and it gets a new deviceID, maybe our kitchen lamp got ID 100 instead of 99 - we just need to go to the first scene that declares the hometable and update the kitchen.lamp value. We the run the scene and it updates the hometable and makes it accessible to all other scenes.

     

    Just a final note. Because ER rules can reference global Lua variables, we can also use Lua functions in rules.

    Please login or register to see this code.

    This works because 'test' is a global Lua variable that is bound to a function. If we had declared 'test' local

    Please login or register to see this code.

    it would not work.

    Posted

    hi jgab, for checking my hometable how to list the home table in debug?

    Posted

    hi I think my homeTable is not okay?

    I tried several things now but in fact I am lost. I only add what to be added in each scene to use the home table in a fresh copy of event runner version 42

    Please advice

     

    Please login or register to see this image.

    /monthly_2019_05/image.png.448a4ad89d508d697f4d8d6944da49e6.png" alt="image.png.448a4ad89d508d697f4d8d6944da49e6.png" />

     

     

     

  • Topic Author
  • Posted

    Log what value you get from fibaro:getGlobalValue

    Please login or register to see this code.

    ...there is obvious something strange with the value.

    Posted

    Goodmorning jgab,

    Seems the table is okay see below just a part of the table.It is listing room.device

    I removed the GV and recreate one>>no effect

    now I am out of ideas

     

    [DEBUG] 07:13:15: {"keuken":{"ledkeuken":399,"afzuigpkap":292,"spotkeuken":217},"system":{"bbeveiligingdisarm":1394,"Var_Dagdelen":1037,"bbeveiligingarm":1395,"Test_DO_NOT_CHANGE":1496,"Var_StookSeizoen":1188,"HomeTableRequest":1494,"HomeTable":1495,"Var_Arm":413},"voortuin":{"spotvlag":96},"hoofdslaapkamer":{"lampplafond":117,"deur":172,"raam":403,"opladertelefoonsjaak":358,"temperatuur":404},"zijkant":{"spotietsenstalling":100},"zolder":{"zolderluik":331,"afzuigingstand3":132,"afzuigingstand2":134},"users":{"arleta":153,"sjaak":4,"admin":2},"woonkamer":{"spotarleta":10322,"televisie":16,"gordijnvoor":48,"spotsjaak":10326,"denon":109,"stoelsjaak":14,"ambilight":10278,"bewegingssensor":166,"lampplafondwest":10281,"lampplafondoost":10325,"spotbeeldwest":10324,"stoelarleta":18,"spotbeeldoost":10323,"spotKastzuid":10312,"gordijnzijkant":52,"spotschilderijwest":10320,"spotschilderijoost":10321,"luxSensor":168,"stekkerCam":6,"gordijnoprit":50,"temperatuur":167},"gastboven":{"raamrechts":77,"lampbed":226,"rolluikLinks":86,"deur":176,"lamptafel":223,"rolluikrechts":81,"raamlinks":221,"temperatuur":177},"gastbeneden":

    Posted

    Restarted HC2>>>>

    hehehe, now I have to solve some errors

    Please login or register to see this image.

    /monthly_2019_05/image.png.a61fa87cb9aaf8f54a5b9725aafacc99.png" alt="image.png.a61fa87cb9aaf8f54a5b9725aafacc99.png" />

  • Topic Author
  • Posted
    2 hours ago, Sjakie said:

    Goodmorning jgab,

    Seems the table is okay see below just a part of the table.It is listing room.device

    I removed the GV and recreate one>>no effect

    now I am out of ideas

     

    [DEBUG] 07:13:15: {"keuken":{"ledkeuken":399,"afzuigpkap":292,"spotkeuken":217},"system":{"bbeveiligingdisarm":1394,"Var_Dagdelen":1037,"bbeveiligingarm":1395,"Test_DO_NOT_CHANGE":1496,"Var_StookSeizoen":1188,"HomeTableRequest":1494,"HomeTable":1495,"Var_Arm":413},"voortuin":{"spotvlag":96},"hoofdslaapkamer":{"lampplafond":117,"deur":172,"raam":403,"opladertelefoonsjaak":358,"temperatuur":404},"zijkant":{"spotietsenstalling":100},"zolder":{"zolderluik":331,"afzuigingstand3":132,"afzuigingstand2":134},"users":{"arleta":153,"sjaak":4,"admin":2},"woonkamer":{"spotarleta":10322,"televisie":16,"gordijnvoor":48,"spotsjaak":10326,"denon":109,"stoelsjaak":14,"ambilight":10278,"bewegingssensor":166,"lampplafondwest":10281,"lampplafondoost":10325,"spotbeeldwest":10324,"stoelarleta":18,"spotbeeldoost":10323,"spotKastzuid":10312,"gordijnzijkant":52,"spotschilderijwest":10320,"spotschilderijoost":10321,"luxSensor":168,"stekkerCam":6,"gordijnoprit":50,"temperatuur":167},"gastboven":{"raamrechts":77,"lampbed":226,"rolluikLinks":86,"deur":176,"lamptafel":223,"rolluikrechts":81,"raamlinks":221,"temperatuur":177},"gastbeneden":

     

    The way you have described the problem to me is

    1. You create a hometable in one scene and store it in a fibaro global: fibaro:setGlobal("HomeTable",json.encode(HT))

    2. In other scenes you do: HT = json.decode(fibaro:getGlobal("HomeTable")) and get an error in json.decode

    Is that correct?

    Well, in that case we need to see the whole table to understand what causing json.decode to give an error.

    json.decode and json.encode is part of the HC2 and not ER specific.

    Posted
    1 hour ago, jgab said:

     

    The way you have described the problem to me is

    1. You create a hometable in one scene and store it in a fibaro global: fibaro:setGlobal("HomeTable",json.encode(HT))

    2. In other scenes you do: HT = json.decode(fibaro:getGlobal("HomeTable")) and get an error in json.decode

    Is that correct?

    Well, in that case we need to see the whole table to understand what causing json.decode to give an error.

    json.decode and json.encode is part of the HC2 and not ER specific.

    hi,

    yes your resume is correct

    sorry but I forgot one thing to do and that was a restart of HC2 that did the job!!!

    After restart the mentioned error was gone I only have some other errors.

    Where am I know;

    updated the most of my scenes (some with errors, typo is the main issue). To be honest I regret did not start with using HomeTable to list all devices its making rules very simple and fast!!!!

     

     

     

    Posted

    Hi jgab,

    Question about hue

     

    _homeTable   = "HomeTable" -- Name", of your HomeTable variable (fibaro global)
    _HueUserName ="3SMuZzruMd9ZedzEFZlrxEaxNHZn5qMWy465roai" -- set to Hue user name            -- Hue bridges, Ex. {{name='Hue',user=_HueUserName,ip=_HueIP}}
    _HueHubs ={{name='Hue',user=_HueUserName,ip= "192.168.1.126"}}
    _myNodeRed   = "http://192.168.1.50:1880/eventrunner" -- Ex. used for Event.postRemote(_myNodeRed,{type='test'})

    if here is a refernce to "HomeTable"why ist should be listed in each scene where "HomeTable"is used?

    can the hue data be stored in "HomeTable"?

    Thanks for your support

     

    Posted

    goodmorning jgab,

    I have a rule to open the curtains:

    Rule.eval("once(oprit.luxsensor:lux > 105)  & 05:00..09:15 => 1454:start ; wait(00:00:15) ;  woonkamer.gordijnvoor:value=100 ; wait(00:00:8); woonkamer.gordijnzijkant:value=100 ; wait(00:00:10); woonkamer.gordijnoprit:value=100 ; wait(00:00:10); eetkamer.gordijnachter:value=100 ; wait(00:00:10); eetkamer.gordijnzijkant:value=100")
       

    1454:start is a scene who starts Sonos to pronounce that the curtains are getting opend

    Sonos pronounce 3 times if I modify it in once( 1454:start) it does not change it. I would like just one.

     

    If my curtains get the trigger to open they will open a split second wait less  than one sec and open

    Please advice

  • Topic Author
  • Posted

    Please login or register to see this code.

    You can not have :start as condition as it is an action and doesn't return any value (true or false).

    If you want something to only happen once in a time interval, you put once around the time.

    Doesn't "woonkamer.gordijnvoor:open" work?

     

    Anyway, please download the latest version of ER - there may have been an error introduced in the last version that could affect 'setValue', and ':value' and could be part of your problems.

    /J

  • Topic Author
  • Posted

    Sorry, my patch made it worse. Wait for downloading a new version until I fixed it

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Reply to this topic...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...