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



jgab

Recommended Posts

Hello Jan,

I am still smoothed out my alarm scene.>>hehe

Surprised as I was after testing 20 times with some doors open the system suddenly  used the open door to switch in alarm state.

I modified all my rules in:

To check:

          Rule.eval("hal.check:isOn & hal.tussendeur:breached => log('let op tussen deur hal open'); $Telegram='Let op er staat een tussendeur in de hal open'")

To arm:

         Rule.eval("hoofdslaapkamer.bbeveiliging:isOn & hal.locatiegezin:isOn & hal.tussendeur:safe => hal.tussendeur:armed=1")

So alarm will be triggered:

        Rule.eval("hoofdslaapkamer.bbeveiliging:isOn & hal.tussendeur:breached & hal.tussendeur:armed=='1' => post(#AlarmState); remote(1627,#AlarmState);log('hal tussen deur breached'); $Telegram='Alarm, hal.tussendeur breached'")

I do not see anything I missed?

For the binairy sensor I am confused both are working but whats the

good one?

Rule.eval(" alarmapp.elroalarm:armed=='0'  => post(#AlarmState); log('Elro breached'); $Telegram='Alarm, ELRO breached'")
          Rule.eval(" alarmapp.elroalarm:value=='0'

 

 

Please login or register to see this attachment.

Link to comment
Share on other sites

what is the correct rule for my example below? If i want to check lux value is higher than 250

 

Please login or register to see this code.

and is this publish rule correct?

Please login or register to see this code.

 

Edited by jompa68
Link to comment
Share on other sites

I wanted to have same solution for my Google Home like i have for my Alexa, to integrate it with node-red and ER.

Found

Please login or register to see this link.

, it is a free module for node-red (donation possible)

So i did give it a try and it was easy to setup. You find instructions on the link above.

 

Please login or register to see this image.

/monthly_2019_07/990914244_Skrmavbild2019-07-16kl_21_18_36.png.339fabd9543a667e2ea9cfbe4917e3d9.png" />

 

Node-Red flow

Please login or register to see this code.

ER rules

Please login or register to see this code.

1196499996_Skrmavbild2019-07-16kl_21_19_04.png.c858b5e56ff8658f9dad4ca19477774e.png

 

device in Google Home App

AAC11A5B-4854-4884-9671-82AA8E04E8FB.jpeg.f3a5d65a9844534729b8784c50be4069.jpeg

Edited by jompa68
  • Like 1
Link to comment
Share on other sites

  • Topic Author
  • On 7/15/2019 at 6:39 PM, jompa68 said:

    Think i got it to work

    Please login or register to see this code.

     

     

    Yes, this is a straightforward solution. The advantage is that the value 250 can be fetched from a variable. 

     

    However, another solution is to leverage the event matchning support that is builtin, and that allow us to only match values that fullfil certain conditions.

    Ex.

    Please login or register to see this code.

    This will bind the local script variable 'lux' to the lux field, but the match will only succeed if the value is >= 250.

    If we don't need the 'lux' value the last rule can be replaced with

    Please login or register to see this code.

    We can do it even more efficient and only subscribe to events with lux>=250. 

    Please login or register to see this code.

    This means that every #VirtualSensor{deviceID=Lux.ute} we receive is guaranteed to have value >= 250 and we get less traffic between the scenes.

     

     

    38 minutes ago, jompa68 said:

    I wanted to have same solution for my Google Home like i have for my Alexa, to integrate it with node-red and ER.

    Found

    Please login or register to see this link.

    , it is a free module for node-red (donation possible)

    So i did give it a try and it was easy to setup. You find instructions on the link above.

     

    Please login or register to see this link.

     

    Nice. It seems to allow for a larger vocabulary than the local Alexa node. I may need to invest in a google home device...

    Edited by jgab
    Link to comment
    Share on other sites

  • Topic Author
  • On 7/11/2019 at 5:57 PM, Sjakie said:

    Hello Jan,

    I am still smoothed out my alarm scene.>>hehe

    Surprised as I was after testing 20 times with some doors open the system suddenly  used the open door to switch in alarm state.

    I modified all my rules in:

    To check:

              Rule.eval("hal.check:isOn & hal.tussendeur:breached => log('let op tussen deur hal open'); $Telegram='Let op er staat een tussendeur in de hal open'")

    To arm:

             Rule.eval("hoofdslaapkamer.bbeveiliging:isOn & hal.locatiegezin:isOn & hal.tussendeur:safe => hal.tussendeur:armed=1")

    So alarm will be triggered:

            Rule.eval("hoofdslaapkamer.bbeveiliging:isOn & hal.tussendeur:breached & hal.tussendeur:armed=='1' => post(#AlarmState); remote(1627,#AlarmState);log('hal tussen deur breached'); $Telegram='Alarm, hal.tussendeur breached'")

    I do not see anything I missed?

    For the binairy sensor I am confused both are working but whats the

    good one?

    Rule.eval(" alarmapp.elroalarm:armed=='0'  => post(#AlarmState); log('Elro breached'); $Telegram='Alarm, ELRO breached'")
              Rule.eval(" alarmapp.elroalarm:value=='0'

     

     

    Please login or register to see this attachment.

     

    The error you get in the log screendump is related to some Hue device that doesn't exists. Does Hue device with id 10 exist?

    Link to comment
    Share on other sites

    Hello Jan,

    Thanks for your answer!

    - Hue 10 is an existing lamp, I am getting much errors with HUE. I also switched off all fancy clors with Hue because of that. I must see if it also goes wrong if I do it with lua or perhaps with nodered.

    - Is this okay for Binary sensor>>> Rule.eval(" alarmapp.elroalarm:value=='0'  ?

     

     

     

    Link to comment
    Share on other sites

    Hi Jan,

    Ical gives the following debug message. VERSION.json ??

     

    [DEBUG] 15:41:24: iCal - EventRunner v0.9 B12
    [DEBUG] 15:41:24: Fibaro software version: 4.542
    [DEBUG] 15:41:24: HC2 uptime: 672 hours
    [DEBUG] 15:41:24: Sunrise 04:41, Sunset 21:50
    [DEBUG] 15:41:24:
    [DEBUG] 15:41:24: Loading rules
    [DEBUG] 15:41:24: VD iCal ER already exist
    [DEBUG] 15:41:24:
    [DEBUG] 15:41:24: Scene running
    [DEBUG] 15:41:26: Slow mailbox watch:1.997071s
    [DEBUG] 15:41:26: New ICal version, v:0.9, fix:B11
    [DEBUG] 15:41:26: Patching scene to latest version

    Link to comment
    Share on other sites

    Hello Jan,

    If I arm my house it arm the doors and windows but not the motion sensors??

     Rule.eval("hoofdslaapkamer.bbeveiliging:isOn & hal.locatiegezin:isOn & serre.deur => serre.deur:armed=1")
     Rule.eval("hoofdslaapkamer.bbeveiliging:isOn & hal.locatiegezin:isOn => eetkamer.bewegingssensor:armed=1")
     Rule.eval("hoofdslaapkamer.bbeveiliging:isOn & hal.locatiegezin:isOn => woonkamer.bewegingssensor:armed=1")

    Device 145 and 166 are motion sensors

    Please login or register to see this image.

    /monthly_2019_07/image.png.625a19e3109715c87030e732d313a47f.png" />

    What is my mistake?

     

    Link to comment
    Share on other sites

  • Topic Author
  • 1 hour ago, FrankT said:

    Hi Jan,

    Ical gives the following debug message. VERSION.json ??

     

    [DEBUG] 15:41:24: iCal - EventRunner v0.9 B12
    [DEBUG] 15:41:24: Fibaro software version: 4.542
    [DEBUG] 15:41:24: HC2 uptime: 672 hours
    [DEBUG] 15:41:24: Sunrise 04:41, Sunset 21:50
    [DEBUG] 15:41:24:
    [DEBUG] 15:41:24: Loading rules
    [DEBUG] 15:41:24: VD iCal ER already exist
    [DEBUG] 15:41:24:
    [DEBUG] 15:41:24: Scene running
    [DEBUG] 15:41:26: Slow mailbox watch:1.997071s
    [DEBUG] 15:41:26: New ICal version, v:0.9, fix:B11
    [DEBUG] 15:41:26: Patching scene to latest version

    sorry, forgot to update version info. B12 is latest.

    12 minutes ago, Sjakie said:

    Hello Jan,

    If I arm my house it arm the doors and windows but not the motion sensors??

     Rule.eval("hoofdslaapkamer.bbeveiliging:isOn & hal.locatiegezin:isOn & serre.deur => serre.deur:armed=1")
     Rule.eval("hoofdslaapkamer.bbeveiliging:isOn & hal.locatiegezin:isOn => eetkamer.bewegingssensor:armed=1")
     Rule.eval("hoofdslaapkamer.bbeveiliging:isOn & hal.locatiegezin:isOn => woonkamer.bewegingssensor:armed=1")

    Device 145 and 166 are motion sensors

    Please login or register to see this link.

    What is my mistake?

     

    When the rule runs it should log the fibaro:call(deviceID,"setArmed",1) - does it do that? (also _debugFlags.fcall should be set to true)

    Link to comment
    Share on other sites

    Sorry Jan,

    That I forgot, yes it is listed. Fibaro alarm panel is disabled.

    I was away from home and saw it on the app 1.4

    Fibaro  shows Doors as armed!

                               motion sensors not armed!

    Now I am unable to find it?

     

    Please login or register to see this image.

    /monthly_2019_07/image.png.953039960969a881ad79fbfb80cceed5.png" />

    Link to comment
    Share on other sites

    Hi Jan,

    need som help to understand what's happening. I have a scene now running for 2 weeks without any problems but  today I got this:

    Please login or register to see this image.

    /monthly_2019_07/error.jpg.d8fce315c432a142bb39ca5b7609e83e.jpg" />

    {"bedlamp_frank":122,"bedlamp_margaretha":173,"balkondorr":370,"temp_balkondorr":371,"nodon_wallswitch":424} is not used at all in this scene.

     

      rule("@@00:10 => a=tonumber($yttertemperatur); b= tonumber($windhastighet); c= $windriktning; d=tonumber($regn); remote(_myNodeRed,#egetwetter{yttertemp=a, vindstyrka=b, vindriktning=c, regn=d})")
     rule("@@00:01 => remote(_myNodeRed,#wetter{})")

     --Får från NodeRed tillbaka 'cloud'= molntäckning. 

      rule([[#wetter => 
          d=tjson(env.event); h=string.find(d,"data")+6; g=string.find(d,"}"); moln=string.sub(d,h,g-1); tid=ostime();
          lb = tonumber(luxb:value); lf = tonumber(luxf:value); log('luxbak luxfram = %s %s', lb,lf); m1=tonumber(screen:value); 
          m2=tonumber(sovm:value); m3=tonumber(tvm:value); m4=tonumber(extram:value); m5=tonumber(altanm:value); log('m1..m5 %s %s %s %s %s',m1,m2,m3,m4,m5);
          post(#tvrum); post(#extrarum);
          || (08:00..15:00) >> post(#screen); post(sovrum)
          || (sunset-10..sunset+50) >> post(#nattscreen)
          ]])      
     
      rule([[#nattscreen => 
           || (lb < 2000) & (m1 == 99) >> screen:value = ner; log('4 SCREEN NED KVÄLL %s %s',y,m1)
           || m1 >> log('inget nattscreen lb m1 %s %s',lb,m1)
           ]])
           
      rule([[#screen => 
          || (lb > lf) & (lb > 8000) & (moln <= 60) & (08:00..15:00) & (m1 > 25) & (a > 0) & (screen:last > 00:15) >> screen:value = ner; _lux=lb; log('m1 screen NED 1 %s %',moln, screen:last) 
          || (lb > lf) &(lb > 8000) & (lb < 12000) & (moln > 60) & (08:00..15:00) & (m1 == 0) >> screen:value = upp;log('m1 screen UPP 2 moln mer 60 %s %s %s %s',moln,a,lb, screen:last)
          || (lf > lb) & (lb < 14000) & (08:00..15:00) & (m1 == 0) >> screen:value = upp; log('m1  SCREEN UPP 3 moln %s %s %s %s %s',m1, moln, lb, lf, screen:last)
          || m1 >> log('inget screen lb moln m1 %s %s %s', lb, moln, m1)
          ]])  

     

    Link to comment
    Share on other sites

  • Topic Author
  • 1 hour ago, FrankT said:

    Hi Jan,

    need som help to understand what's happening. I have a scene now running for 2 weeks without any problems but  today I got this:

    {"bedlamp_frank":122,"bedlamp_margaretha":173,"balkondorr":370,"temp_balkondorr":371,"nodon_wallswitch":424} is not used at all in this scene.

     

      rule("@@00:10 => a=tonumber($yttertemperatur); b= tonumber($windhastighet); c= $windriktning; d=tonumber($regn); remote(_myNodeRed,#egetwetter{yttertemp=a, vindstyrka=b, vindriktning=c, regn=d})")
     rule("@@00:01 => remote(_myNodeRed,#wetter{})")

     --Får från NodeRed tillbaka 'cloud'= molntäckning. 

      rule([[#wetter => 
          d=tjson(env.event); h=string.find(d,"data")+6; g=string.find(d,"}"); moln=string.sub(d,h,g-1); tid=ostime();
          lb = tonumber(luxb:value); lf = tonumber(luxf:value); log('luxbak luxfram = %s %s', lb,lf); m1=tonumber(screen:value); 
          m2=tonumber(sovm:value); m3=tonumber(tvm:value); m4=tonumber(extram:value); m5=tonumber(altanm:value); log('m1..m5 %s %s %s %s %s',m1,m2,m3,m4,m5);
          post(#tvrum); post(#extrarum);
          || (08:00..15:00) >> post(#screen); post(sovrum)
          || (sunset-10..sunset+50) >> post(#nattscreen)
          ]])      
     
      rule([[#nattscreen => 
           || (lb < 2000) & (m1 == 99) >> screen:value = ner; log('4 SCREEN NED KVÄLL %s %s',y,m1)
           || m1 >> log('inget nattscreen lb m1 %s %s',lb,m1)
           ]])
           
      rule([[#screen => 
          || (lb > lf) & (lb > 8000) & (moln <= 60) & (08:00..15:00) & (m1 > 25) & (a > 0) & (screen:last > 00:15) >> screen:value = ner; _lux=lb; log('m1 screen NED 1 %s %',moln, screen:last) 
          || (lb > lf) &(lb > 8000) & (lb < 12000) & (moln > 60) & (08:00..15:00) & (m1 == 0) >> screen:value = upp;log('m1 screen UPP 2 moln mer 60 %s %s %s %s',moln,a,lb, screen:last)
          || (lf > lb) & (lb < 14000) & (08:00..15:00) & (m1 == 0) >> screen:value = upp; log('m1  SCREEN UPP 3 moln %s %s %s %s %s',m1, moln, lb, lf, screen:last)
          || m1 >> log('inget screen lb moln m1 %s %s %s', lb, moln, m1)
          ]])  

     

     

    Could it be '#sovrum' instead of 'sovrum' in this line?

    Please login or register to see this code.

    'sovrum' seems like a hometable value.

    Edited by jgab
    Link to comment
    Share on other sites

  • Topic Author
  • 8 minutes ago, jgab said:

     

    Could it be '#sovrum' instead of 'sovrum' in this line?

    Please login or register to see this code.

    'sovrum' seems like a hometable value.

     

    Btw. I see what you do here

    Please login or register to see this code.

    but can't you do something like below?

    Please login or register to see this code.

    I don't know how the data structure look like but you should be able to make an access path to the cloud field.

    Link to comment
    Share on other sites

    33 minutes ago, jgab said:

    

    48 minutes ago, jgab said:

    Could it be '#sovrum' instead of 'sovrum' in this line?

    Please login or register to see this code.

    'sovrum' seems like a hometable value.

     

    Btw. I see what you do here

    Please login or register to see this code.

    but can't you do something like below?

    Please login or register to see this code.

    Thank you Jan. Sometimes one gets blind, I changed a little in the code yesterday and forgot what I had changed!

    But sorry d=env.event.data.cloud does not work: ': attempting to index non table with key:'cloud'. Node Red sends back the following:

    "%7B%22type%22:%22wetter%22,%22data%22:100%7D"
    1: "%%ER%%"
    Link to comment
    Share on other sites

  • Topic Author
  • 3 minutes ago, FrankT said:

    Thank you Jan. Sometimes one gets blind, I changed a little in the code yesterday and forgot what I had changed!

    But sorry d=env.event.data.cloud does not work: ': attempting to index non table with key:'cloud'. Node Red sends back the following:

    "%7B%22type%22:%22wetter%22,%22data%22:100%7D"
    1: "%%ER%%"

     

    So the event you get back from NR is

    Please login or register to see this code.

    then this should work.

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    Jan good morning,

    What I do overlook?

    Rule is the same as others

                Rule.eval("hoofdslaapkamer.bbeveiliging:isOn & woonkamer.raam:breached & woonkamer.raam:armed=='1' => post(#AlarmState); remote(1627,#AlarmState); log('Alarm, woonkamer raam geopend');  $Telegram='Alarm, woonkamer raam geopend'")

     

    in HT woonkamer.raam

     

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

  • Topic Author
  • 6 minutes ago, Sjakie said:

    Jan good morning,

    What I do overlook?

    Rule is the same as others

                Rule.eval("hoofdslaapkamer.bbeveiliging:isOn & woonkamer.raam:breached & woonkamer.raam:armed=='1' => post(#AlarmState); remote(1627,#AlarmState); log('Alarm, woonkamer raam geopend');  $Telegram='Alarm, woonkamer raam geopend'")

     

    in HT woonkamer.raam

    It looks like  woonkamer.raam:armed returns nil. 

    Can you just do Rule.eval("log('%s',tostring(woonkamer.raam:armed))") and see what you get?

    I'm trying to improve the error handling (next version). Now when I see that the error is on line 1728 and 1453 in your log I can't match that against the line in the code because you have added lines in the beginning (your rules). 

    If you can, it would be nice to get code in lines 1453 and 1728 so I can verify that it is indeed the "==" in "woonkamer.raam:armed=='1' " that is the problem.

    Link to comment
    Share on other sites

     

     

     

     

     

    Please login or register to see this image.

    /monthly_2019_07/image.png.ede626ee3f0c2a012b053e0d386352ba.png" />

    Please login or register to see this attachment.

     

    Rule.eval("log('%s',tostring(woonkamer.raam:armed))")

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

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