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

also tested with a new blank scene and only those rules. Same behavior, no incoming events

Link to comment
Share on other sites

  • Topic Author
  • 9 minutes ago, jompa68 said:

    No events appears in 2:nd scene.

    Please login or register to see this code.

     

     

    Ah, it's in the emulator?

    Link to comment
    Share on other sites

    Yes, testing there

     

    Update

    Stange, now it works in my HC2. ?

    Edited by jompa68
    Link to comment
    Share on other sites

  • Topic Author
  • 15 minutes ago, jompa68 said:

    Yes, testing there

     

    Update

    Stange, now it works in my HC2. ?

    It should work on the HC2.

    The emulated was broken. It was actually in EventRunner.lua. Pushed a new version B65. pub/sub between emulated scenes should work now.

    If you just want to patch your EventRunner scenes instead of updating to B65 it was the function findScenes on line ~850

    Please login or register to see this code.

    It's still a bit shaky and it's on my todo list to get the event handling between emulated scenes (and emulated and HC2 scenes) working properly.

    Edited by jgab
    Link to comment
    Share on other sites

    Hallo Jan,

    In a post from @frankT you are using:

    Please login or register to see this code.

    Is it postRemote in combination with Event?

    Without Event only remote

     

    Link to comment
    Share on other sites

  • Topic Author
  • 1 minute ago, Sjakie said:

    Hallo Jan,

    In a post from @frankT you are using:

    Please login or register to see this code.

    Is it postRemote in combination with Event?

    Without Event only remote

     

     

    So that code is "pure" Lua. If you want to do the same with EventScript it is

    Please login or register to see this code.

    however sometimes it is more convenient to write stuff in Lua.

    Link to comment
    Share on other sites

    Hi Jan,

    Thanks.

    In the morning the sun is bothering me in  my eyes the side window curtain will be closed I create:

        Rule.eval("@sunrise+01:00 => remote(_myNodeRed,#speak{data='gordijn oprit wordt gesloten'}); wait(00:00:15);  woonkamer.gordijnoprit:value=0")         
        Rule.eval("@sunrise+01:50 => remote(_myNodeRed,#speak{data='gordijn oprit wordt geopend'}); wait(00:00:15);  woonkamer.gordijnoprit:open")   

    can I add something from Openweathermap.org when it is cloudy it will execute this command? (I have a api key)

    Should be nice if yes so I can use in the evening for the other curtain to take away sun reflection.

    Please advise

    Link to comment
    Share on other sites

  • Topic Author
  • 5 minutes ago, Sjakie said:

    Hi Jan,

    Thanks.

    In the morning the sun is bothering me in  my eyes the side window curtain will be closed I create:

        Rule.eval("@sunrise+01:00 => remote(_myNodeRed,#speak{data='gordijn oprit wordt gesloten'}); wait(00:00:15);  woonkamer.gordijnoprit:value=0")         
        Rule.eval("@sunrise+01:50 => remote(_myNodeRed,#speak{data='gordijn oprit wordt geopend'}); wait(00:00:15);  woonkamer.gordijnoprit:open")   

    can I add something from Openweathermap.org when it is cloudy it will execute this command? (I have a api key)

    Should be nice if yes so I can use in the evening for the other curtain to take away sun reflection.

    Please advise

     

    If you install @jompa68 OW scene/VD you could get the weather from that.

    and then you fetch the weather description from the VD label in the ER rule.

    Please login or register to see this code.

    Though I'm a bit unsure what the values for weather descriptions are. @jompa68 ?

     

     

    Link to comment
    Share on other sites

    13 minutes ago, jgab said:

    Though I'm a bit unsure what the values for weather descriptions are. @jompa68 ?

    Depends on the id for actual weather. Here is an example of what can exist in JSON

    Please login or register to see this link.

    Link to comment
    Share on other sites

    Great guys!! Thanks @jgab and @jompa

     

    Jan with testing my alarm it stops with the HUE in special effect mode and restart the scene.

    Can you see what is wrong?

    Thanks in advanced

    Please login or register to see this image.

    /monthly_2019_07/image.png.abd04c255a985059dd2f32ae23327f0b.png" />

     

     ----------------Hue specifications-----------------

    --hehe
     
     
    Hue.define("ambitvlight", nil, 12278)
    Hue.define("lampplafondklokzijde", nil, 12281)
    Hue.define("spotkastlinks", nil, 12312)
    Hue.define("spotschilderijrechts", nil, 12320)
    Hue.define("spotschilderijlinks", nil, 12321)
    Hue.define("spotarleta", nil, 12322)
    Hue.define("spotbeeldrechts", nil, 12323)
    Hue.define("spotbeeldlinks", nil, 12324)
    Hue.define("lampplafondtvzijde", nil, 12325)
    Hue.define("spotsjaak", nil, 12326)
    Hue.define("spotvlag", nil, 12327)
    Hue.define("spotres1", nil, 12328)
    Hue.define("spotres2", nil, 12329)
     
     
    Hue.dump()


     -------------- Trigger rules-----------------------------
       --rule("alarmlights={woonkamer.ambitvlight, woonkamer.lampplafondtvzijde, woonkamer.lampplafondklokzijde, voortuin.spotvlag, voortuin.spotres1, voortuin.spotres2, woonkamer.spotbeeldlinks, woonkamer.spotschilderijlinks, woonkamer.spotkastlinks")
          rule("alarmlights={ woonkamer.spotbeeldlinks, woonkamer.spotschilderijlinks, woonkamer.spotkastlinks, woonkamer.spotbeeldrechts, woonkamer.spotschilderijrechts, woonkamer.ambitvlight, woonkamer.lampplafondtvzijde, woonkamer.lampplafondklokzijde, woonkamer.spotstoelarleta, woonkamer.spotstoelsjaak, voortuin.spotvlag, voortuin.spotres1, voortuinsptres2}")
     --alarmlights on>>>woonkamer.ambitvlight:on; wait(00:00:02) ; woonkamer.lampplafondtvzijde:on; w
    --  Rule.eval("zijkant.spotfietsenstalling:isOn => voortuin.spotvlag:on; colorIndex=1; enable(colorShow)") -- Start show
     --tijdelijk
     --Rule.eval("zijkant.spotfietsenstalling:isOn => voortuin.spotvlag:on; voortuin.spotvlag:value={bri=250, hue=50, sat=100, transitiontime=20, col=75} ")
     Rule.eval("zijkant.spotfietsenstalling:isOn => voortuin.spotres2:on; colorIndex=1; enable(colorShow) ")
      Rule.eval("@23:30 => voortuin.spotvlag:off; colorIndex=1; disable(colorShow)") -- Start show

    --------------------------------------------------------------------
    --achtertuin
     
     Rule.eval("achtertuin.tuinverlichting:isOn => voortuin.spotres2:on & voortuin.spotres1:on; colorIndex=1; enable(colorShow) ")

       Rule.eval("achtertuin.tuinverlichting:isOff => disable(colorShow); voortuin.spotres2:off & voortuin.spotres1:off")             -- Stop show
    ----------------------------------------
     
     
     
      --test
    --   Rule.eval("voortuin.spotres2:isOn =>  voortuin.spotres2:value={sat=250, bri=250, hue=5535} ")  
    --          Rule.eval("for(00:00:10), voortuin.spotres2:isOn =>  (for00:00:10)voortuin.spotres2:off   ")                                          

      --vlagverlichting
     
     colorParams={  -- Table of color values
        {bri=245, hue=0, sat=10, transitiontime=2, col=0},
        {bri=245, hue=50, sat=150, transitiontime=2, col=0},
        {bri=245, hue=30, sat=30, transitiontime=2, col=0},
        {bri=245, hue=30, sat=0, transitiontime=2, col=0},
        {bri=245, hue=150, sat=150, transitiontime=2, col=255},
        {bri=245, hue=30, sat=30, transitiontime=2, col=50},
        {bri=245, hue=100, sat=0, transitiontime=2, col=255},
        {bri=245, hue=30, sat=30, transitiontime=2, col=50},
        {bri=245, hue=180, sat=0, transitiontime=2, col=0},
        {bri=245, hue=75, sat=0, transitiontime=2, col=0},
        {bri=245, hue=150, sat=130, transitiontime=2, col=255},
        {bri=245, hue=30, sat=30, transitiontime=2, col=25},
        {bri=245, hue=200, sat=0, transitiontime=14, col=0},

    }
     
      -- Every 10s, pick a new value from colorParams, wrap around at end of table.
      colorShow = Rule.eval([[@@00:00:10  =>
        voortuin.spotvlag:value=colorParams[colorIndex];
         voortuin.spotres2:value=colorParams[colorIndex];
        colorIndex=(colorIndex % size(colorParams))+1
        ]]).disable() -- Start disabled, next rules enable us.
     
          
       Rule.eval(" voortuin.spotvlag:on => 1455:start ")
       Rule.eval("zijkant.spotfietsenstalling:isOn => voortuin.spotvlag:on; colorIndex=1; enable(colorShow)")             -- Start show

      --Vlagverlichting uit---------
      Rule.eval("#flaglightOff) =>  remote(_myNodeRed,#speak{data='de vlagverlichting wordt uitgeschakeld'}); disable(colorShow); voortuin.spotvlag:off")  --stop show
     

     
     
     
      --ALARM LIGHTS FLIKKERING
     
       colorParams2={  -- Table of color values
        {bri=245, hue=65535, sat=250, transitiontime=1, col=0},
        {bri=50, hue=65535, sat=250, transitiontime=1, col=0},
         {bri=245, hue=65535, sat=250, transitiontime=1, col=0},
        {bri=50, hue=65535, sat=250, transitiontime=1, col=0},
         {bri=245, hue=65535, sat=250, transitiontime=1, col=0},
        {bri=50, hue=65535, sat=250, transitiontime=1, col=0},
         {bri=245, hue=65535, sat=250, transitiontime=1, col=0},
        {bri=50, hue=65535, sat=250, transitiontime=1, col=0},
         {bri=245, hue=65535, sat=250, transitiontime=1, col=0},
        {bri=50, hue=65535, sat=250, transitiontime=1, col=0},
            }
     
      -- Every 15s, pick a new value from colorParams, wrap around at end of table.
      colorShow2 = Rule.eval([[@@00:00:02  =>
        alarmlights:value=colorParams2[colorIndex2];
             colorIndex2=(colorIndex2 % size(colorParams2))+1
        ]]).disable() -- Start disabled, next rules enable us.

      Rule.eval("#AlarmState =>  woonkamer.ambitvlight:on; wait(00:00:02) ; woonkamer.lampplafondtvzijde:on; wait(00:00:02); woonkamer.lampplafondklokzijde:on; wait(00:00:02); voortuin.spotvlag:on; wait(00:00:02); voortuin.spotres1:on; wait(00:00:02); voortuin.spotres2:on; wait(00:00:02); woonkamer.spotbeeldlinks:on; wait(00:00:02); woonkamer.spotschilderijlinks:on; wait(00:00:02); woonkamer.spotkastlinks:on; colorIndex2=1; enable(colorShow2)") -- Start show
     
       Rule.eval("#AlarmStateUit =>  woonkamer.ambitvlight:off; wait(00:00:02) ; woonkamer.lampplafondtvzijde:off; wait(00:00:02); woonkamer.lampplafondklokzijde:off; wait(00:00:02); voortuin.spotvlag:off; wait(00:00:02); voortuin.spotres1:off; wait(00:00:02); voortuin.spotres2:off; wait(00:00:02); woonkamer.spotbeeldlinks:off; wait(00:00:02); woonkamer.spotschilderijlinks:off; wait(00:00:02); woonkamer.spotkastlinks:off; disable(colorShow2)") -- Stop show
     --tijdelijk
        -- Rule.eval("alarmapp.alarmrelais:isOff =>  woonkamer.ambitvlight:off; wait(00:00:02) ; woonkamer.lampplafondtvzijde:off; wait(00:00:02); woonkamer.lampplafondklokzijde:off; wait(00:00:02); voortuin.spotvlag:off; wait(00:00:02); voortuin.spotres1:off; wait(00:00:02); voortuin.spotres2:off; wait(00:00:02); woonkamer.spotbeeldlinks:off; wait(00:00:02); woonkamer.spotschilderijlinks:off; wait(00:00:02); woonkamer.spotkastlinks:off; disable(colorShow2)") -- Stop show

              Rule.eval(" ([email protected]) & #AlarmStateUit => {woonkamer.spotbeeldrechts, woonkamer.spotschilderijrechts, woonkamer.spotstoelsjaak}:on; {woonkamer.spotbeeldrechts, woonkamer.spotschilderijrechts, woonkamer.spotstoelsjaak}:value={bri=150, hue=100, sat=150, transitiontime=20, col=75} ")

            Rule.eval("for(00:15, alarmapp.alarmrelais:isOff)) => {woonkamer.spotbeeldrechts, woonkamer.spotschilderijrechts, woonkamer.spotstoelsjaak}:off")
     


    end -- main()

     

    if I stop this manually by activating two scenes no error. Is it in remote?

    Link to comment
    Share on other sites

  • Topic Author
  • Missing '}' at end of

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    Hello Jan,

    I am still in a loop!

    It is happening I guess

    Arm the house

    alarm

    sounds and light starts

    alarmstateOn

    disarm and alarmstate off, but motion sensor living room breached start cycles again.

    Does that mean it takes to long time to disarm?

    I reversed the order and now no loop???

    But I saw previous the front door same kind of issue kept in mind to look what happend because I did not understand.

    What now if burglar comes to door, door breached loop again?

    A time delay somewhere?

    Please advice

    If I proper understand when the "buglar"moves it will trigger motion sensor and will start cyclus AlarmstateOn again?

     

    Link to comment
    Share on other sites

    So a part of the loop was me! I am sitting in the living>>>omg system works well!

    Link to comment
    Share on other sites

    Jan,

    Here you see that in unarmed condition motion sensor is giving "armed" why?

    I think the error is in the fact I have 2 relays I use

    One arm/disarm

    two AlarmState/ AlarmstateOff

    Now I have placed in Disarm also alarmstate.relays:off

    it seems to tackle the problem see debug 3rd picture. Must now set some message via the VD / relays.

    Please login or register to see this image.

    /monthly_2019_07/image.png.9e7816b3f00ddb3127f35b56ca8b08ef.png" />

    image.png.06b24acc00d2c742930546d2004b3718.png

    image.png.9cde62f0772193a8b70ff3c16d409282.png

    Link to comment
    Share on other sites

    @Sjakie you could also use NodeRed for OpenWeatherMap and get the result back to your scene. I store cloudpercentage and temp in influxdb and send cloudpercentage back to my ER-scene. Found it better then YR weather to run my

    blinds.

     

     

     

    blinds

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    Hello @FrankT,

    Thanks that will become a new challenge!

    Can you be so kind to export the Nodes for the weather?

    Thanks in advance

    Link to comment
    Share on other sites

    1 hour ago, Sjakie said:

    ello @FrankT,

    Thanks that will become a new challenge!

    Can you be so kind to export the Nodes for the weather?

    Thanks in advance

    [{"id":"88bf887.e5d1d78","type":"openweathermap","z":"72fb4069.14e55","name":"OWM väder","wtype":"current","lon":"12.510983","lat":"56.917685","city":"","country":"","language":"sv","x":612.86669921875,"y":206.86666870117188,"wires":[["ea9ac537.89d6b8","4f23123f.0c824c"]]},{"id":"515943e1.458c3c","type":"inject","z":"72fb4069.14e55","name":"Test av OWM","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":288.8572463989258,"y":208.06476402282715,"wires":[["82e675b6.7ea4f8"]]},{"id":"82e675b6.7ea4f8","type":"change","z":"72fb4069.14e55","name":"Address","rules":[{"t":"set","p":"ESceneID","pt":"msg","to":"-1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":448.4893379211426,"y":206.8667335510254,"wires":[["88bf887.e5d1d78"]]},{"id":"43d2ae7f.06a34","type":"influxdb out","z":"72fb4069.14e55","influxdb":"817ab34d.ae4218","name":"OWM_till_InfluxDB","measurement":"weather","precision":"","retentionPolicy":"","x":970,"y":206.39999389648438,"wires":[]},{"id":"ea9ac537.89d6b8","type":"function","z":"72fb4069.14e55","name":"trans2","func":"msg.payload = [\n    [{\n        graderC: msg.payload.tempc,\n        humidity: msg.payload.humidity,\n        lufttryck: msg.payload.pressure,\n        windspeed: msg.payload.windspeed,\n        winddirection: msg.payload.winddirection,\n        clouds: msg.payload.clouds,\n        detail: msg.payload.detail\n    }]\n];\nreturn msg;","outputs":1,"noerr":0,"x":768,"y":206.39999389648438,"wires":[["43d2ae7f.06a34","a0ff7796.a5fae8"]]},{"id":"e657c8d0.6e2f78","type":"link out","z":"72fb4069.14e55","name":"","links":["db2a53ae.ea80f"],"x":1102,"y":283.3999938964844,"wires":[]},{"id":"a0ff7796.a5fae8","type":"debug","z":"72fb4069.14e55","name":"Väder display","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":968.4666748046875,"y":245.93331909179688,"wires":[]},{"id":"4f23123f.0c824c","type":"function","z":"72fb4069.14e55","name":"trans1","func":"msg.payload={type:\"wetter\",data : msg.payload.clouds}\nmsg.url=null\nreturn msg;","outputs":1,"noerr":0,"x":802.86669921875,"y":289.2666931152344,"wires":[["e657c8d0.6e2f78"]]},{"id":"817ab34d.ae4218","type":"influxdb","z":"","hostname":"192.168.1.158","port":"8086","protocol":"http","database":"hc2","name":"","usetls":false,"tls":""}]

     

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    Hello Jan,

    I am cleaning my scene a bit and want some more yellow debug lines.

    What I am doing wrong with this one?

    Please advice

     

    Please login or register to see this image.

    /monthly_2019_07/image.png.a7ebb5c8709b85298cfcee7cc016695c.png" />?

     

    log Disarmed?

     

    Link to comment
    Share on other sites

  • Topic Author
  • 7 hours ago, Sjakie said:

    Hello Jan,

    I am cleaning my scene a bit and want some more yellow debug lines.

    What I am doing wrong with this one?

    Please advice

     

    Please login or register to see this link.

    ?

     

    log Disarmed?

     

     

    No, 'log' still works. My guess is that the 'wait(00:05)' makes the rule suspend for 5minutes and the log of 'Disarmed' comes much later in the log.

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