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
12 minutes ago, jgab said:

or, more generally?

Think this will match perfect. Less code to change when new notifications is added :D

Thanks @jgab

Posted (edited)
31 minutes ago, jgab said:

or, more generally?

Double post o.O

Edited by jompa68
Posted

Error in the function notify(str)

u:msg=log(n.msg)

Please login or register to see this code.

 

  • Topic Author
  • Posted
    3 minutes ago, jompa68 said:

    Error in the function notify(str)

    u:msg=log(n.msg)

    Please login or register to see this code.

     

    My fault. 'log' only exists in ER rules.

    need to replace with fibaro:call(u,"sendPush",n.msg)

    Posted

    Why is it missing this weeks entries?

    Please login or register to see this image.

    /monthly_2019_06/image.png.4542050e085f48e2fa98a2edf7843577.png" alt="image.png.4542050e085f48e2fa98a2edf7843577.png" />

    Please login or register to see this attachment.

     

     

  • Topic Author
  • Posted
    4 hours ago, jompa68 said:

    Why is it missing this weeks entries?

    Please login or register to see this link.

    Please login or register to see this attachment.

     

     

     

    Strange, haven't seen that behavior. Does iCal.lua log all the events? iCal.lua only tries to fetch events after the current time/date but it looks like it's skipping days... or is it just the VD that has problem?

    Will have a look when I'm back home.

    Posted

    Same behavior on iCal.lua. Skipping this weeks entries.

    Posted

    Hello Jan,

    When I activate voortuin.test:isOn  or manual or in the sytem it is not listed in the debug window of the ER sceneso no action. Debug for rules and rulesfalse is true.

    voortuin.test is listed in the header (96) What I overlook?

    Please advice

    Please login or register to see this image.

    /monthly_2019_06/image.png.a540fabff62b4fb1a6071f2e623c7e3e.png" alt="image.png.a540fabff62b4fb1a6071f2e623c7e3e.png" />

    Hello Jan,

    When I activate voortuin.test:isOn  or manual or in the sytem it is not listed in the debug window of the ER sceneso no action. Debug for rules and rulesfalse is true.

    voortuin.test is listed in the header (96) What I overlook?

    Please advice

    image.png.a540fabff62b4fb1a6071f2e623c7e3e.png

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

    Hello Jan,

    When I activate voortuin.test:isOn  or manual or in the sytem it is not listed in the debug window of the ER sceneso no action. Debug for rules and rulesfalse is true.

    voortuin.test is listed in the header (96) What I overlook?

    Please advice

    Can you send me the scene an I can have a look at it.

    Posted

    Hereby,

    --[[
    %% properties
    96 value
    %% events
    %% globals
    %% autostart
    --]]


    -- Don't forget to declare triggers from devices in the header!!!
    if dofile and not _EMULATED then _EMBEDDED={name="EventRunner", id=20} dofile("HC2.lua") end

    _version,_fix = "2.0","B54"  -- May 30, 2019  

    --[[
    -- EventRunner. Event based scheduler/device trigger handler
    -- Copyright 2019 Jan Gabrielsson. All Rights Reserved.
    -- Email: [email protected]
    --]]

    _sceneName   = "Test"      -- Set to scene/script name
    _homeTable   = "HomeTable" -- Name of your HomeTable variable (fibaro global)
    _HueHubs     = {}          -- Hue bridges, Ex. {{name='Hue',user=_HueUserName,ip=_HueIP}}
    _myNodeRed   = "http://192.168.1.89:1880/eventrunner" -- Ex. used for Event.postRemote(_myNodeRed,{type='test'})
    --if dofile then dofile("credentials.lua") end -- To not accidently commit credentials to Github, or post at forum :-)
    -- E.g. Hue user names, icloud passwords etc. HC2 credentials is set from HC2.lua, but can use same file.

    -- debug flags for various subsystems...
    _debugFlags = {
      post=true,invoke=false,triggers=true,dailys=false,rule=true,ruleTrue=true,hue=false,msgTime=false,
      fcall=true, fglobal=false, fget=false, fother=true
    }
    ---------------- Here you place rules and user code, called once at startup --------------------
    function main()
      local rule,define = Rule.eval, Util.defvar

      if _EMULATED then
        --_System.speed(true)               -- run emulator faster than real-time
        --_System.setRemote("devices",{5})  -- make device 5 remote (call HC2 with api)
        --_System.installProxy()            -- Install HC2 proxy sending sourcetriggers back to emulator
      end

     
      --or read in "HomeTable" from a fibaro global variable (or scene)
      --local HT = type(_homeTable)=='number' and api.get("/scenes/".._homeTable).lua or fibaro:getGlobalValue(_homeTable)
      --HT = json.decode(HT)
      local HT = json.decode(fibaro:getGlobalValue("HomeTable"))
      _myNodeRed   = "http://192.168.1.89:1880/eventrunner"
     
      Util.defvars(HT) -- Make HomeTable variables available in EventScript
      Util.reverseMapDef(HT) -- Make HomeTable variables available for logger

      rule("@@00:00:05 => f=!f; || f >> log('Ding!') || true >> log('Dong!')") -- example rule logging ding/dong every 5 second

      rule("@{catch,06:00} => Util.checkVersion()") -- Check for new version every morning at 6:00
      rule("#ER_version => log('New ER version, v:%s, fix:%s',env.event.version,env.event.fix))")
      --if dofile then dofile("example_rules.lua") end     -- some more example rules to try out...

      -------------- Trigger rules-----------------------------
     -- Rule.eval("#speak{text='$text'} => remote(_myNodeRed,#speak{data=text,volume=env.event.volume | '50'})") -- create event handler-- create event handler

     

     
    -- Rule.eval("post(#speak{text='Hallo Arleta ben je al  gereed met je karweitje?!', volume='75'})") -- volume 75

    Rule.eval("voortuin.test:isOn => remote(_myNodeRed,#speak{data='Hallo, Saartje doet haar best al een tijdje'})")

      -- Rule.eval("test.test:isOn =>  #speak(' Saartje is even aan het rusten')")

    --speak('Hallo en goede morgen!')")
     
     --   speak('Hallo en goede morgen!')")
    --<<<<<<<<<<<<<<<<<<<<<<send push notification>>>>>>>>>>>>>>   
     
      -- Simulated triggers
      if _EMULATED then
     --   rule("wait(t/16:00); oprit.luxsensor:value=100") -- set sensor value to 100 at 16:00 today
     

     
     
     
      --if dofile then dofile("example_rules.lua") end     -- some more example rules to try out...
    end -- main()

    Posted

    Hello Jan,

    I activated 96 about 14 times before send you the message.

    Imade a copy for you and now I activated 96 and its signal came

    Please login or register to see this image.

    /monthly_2019_06/image.png.962594aa7ae29a1bf2d0e25e41363d22.png" alt="image.png.962594aa7ae29a1bf2d0e25e41363d22.png" />

    Posted

    I think the date is 1 week wrong when adding a reoccurring entry, see my calendar and VD(same info in ical.lua)

     

    Please login or register to see this image.

    /monthly_2019_06/1529186531_Skrmavbild2019-06-04kl_18_22_22.png.90d5d37949215730b4faf1f4de676699.png" alt="1529186531_Skrmavbild2019-06-04kl_18_22_22.png.90d5d37949215730b4faf1f4de676699.png" />1118927201_Skrmavbild2019-06-04kl_18_22_13.png.9eee239ab3629fc95f3ebbeae03e91b9.png

    Posted (edited)

    Another question @jgab

     

    Please login or register to see this code.

    from ZBS debug window when using RFID tag 7

    Please login or register to see this code.

    What is the correct setup?

     

    After some reading on the topic i found a solution that works

    Please login or register to see this code.

    always good to search :D

    Edited by jompa68
    Working code
    Posted

    Hello Jan,

    I just checked my scenes and the load of HC2 is low-medium.

    All scenes respond the same. It was running the whole day smooth.

    Please login or register to see this image.

    /monthly_2019_06/image.png.a2ad5db5319663452a5509a5a56af79c.png" alt="image.png.a2ad5db5319663452a5509a5a56af79c.png" />

  • Topic Author
  • Posted
    12 hours ago, jompa68 said:

    I think the date is 1 week wrong when adding a reoccurring entry, see my calendar and VD(same info in ical.lua)

    Yes, there were a bug in recurring events, fixed the, pushed vB8.

    Posted
    Just now, jgab said:

    Yes, there were a bug in recurring events, fixed the, pushed vB8.

    Great, thanks.
    What about auto-update of ical.lua, will you implement that also?

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

    Hello Jan,

    I just checked my scenes and the load of HC2 is low-medium.

    All scenes respond the same. It was running the whole day smooth.

     

    I'm a bit lost on this at the moment. I have made an alternative "keepalive" routine in Supervisor that doesn't 'ping' but just looks at fibaro:countScenes() to see if the scene is running. It's not as good as ping because the scene could "crash" but still have an running instance. However, it may work better for you until I can understand what goes wrong for you.

    So, download the latest Supervisor.lua (B9) and set

    Please login or register to see this code.

    before main()

    Posted

    Good morning Jan,

    Done B9 and ER 56 now.

    This rule pronounce every few miutes, how to reduce only the message into one time?

    Please advice and thanks for the support.

     

        Rule.eval([[oprit.luxsensor:lux > 105  & once(05:00..09:15) | sunrise =>   remote(_myNodeRed,#speak{data='de gordijnen worden geopend'}) ; wait(00:00:15) ;    woonkamer.gordijnvoor:open ; wait(00:00:08);woonkamer.gordijnzijkant:open ; wait(00:00:10);   woonkamer.gordijnoprit:open ; wait(00:00:10);   eetkamer.gordijnachter:value=100 ; wait(00:00:10);   eetkamer.gordijnzijkant:value=100]])         
           

  • Topic Author
  • Posted (edited)
    6 minutes ago, Sjakie said:

    Good morning Jan,

    Done B9 and ER 56 now.

    This rule pronounce every few miutes, how to reduce only the message into one time?

    Please advice and thanks for the support.

     

        Rule.eval([[oprit.luxsensor:lux > 105  & once(05:00..09:15) | sunrise =>   remote(_myNodeRed,#speak{data='de gordijnen worden geopend'}) ; wait(00:00:15) ;    woonkamer.gordijnvoor:open ; wait(00:00:08);woonkamer.gordijnzijkant:open ; wait(00:00:10);   woonkamer.gordijnoprit:open ; wait(00:00:10);   eetkamer.gordijnachter:value=100 ; wait(00:00:10);   eetkamer.gordijnzijkant:value=100]])         
           

     

    It's the "| sunrise" that causes the problem. What do you want to achieve? Why 'sunrise' ?

     

    You want to do the message if "oprit.luxsensor:lux > 105  & once(05:00..09:15)" OR if the time is sunrise ? - You cannot mix triggers and scheduled times in one rule.

    I would do like this

    Please login or register to see this code.

     

    Edited by jgab
    Posted

    I added sunrise because this week the curtains did not open. Reason was the lux value was "hanging" on 32 orso when it should have been >500.

    ok will take it out.

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