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

Jan,

I have some probs with a rule using #opStaan . As trigger I use it much later than when the post was posted.

To see that in debug I use the deftrigger.

I will combine in one  rule.

Lets frase the question different

let say at 06:45 post(#opStaan)

Can I see in debug around 09:00 the state off post(#opStaan)?

//Sjakie

 

Posted

Jan, HC3 is doing some strange things?

The messages are not correct.

This rule is true

 

Please login or register to see this code.

In debug a lot of rules are marked true but the are not!

Please login or register to see this attachment.

What am I doing wrong?

//Sjakie

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

    Jan,

    I have some probs with a rule using #opStaan . As trigger I use it much later than when the post was posted.

    To see that in debug I use the deftrigger.

    I will combine in one  rule.

    Lets frase the question different

    let say at 06:45 post(#opStaan)

    Can I see in debug around 09:00 the state off post(#opStaan)?

    //Sjakie

     

    Ok, that makes sense. You want to be able to see if post(#opStaan) has been sent earlier.

    However, if you set a (trigger) variable like 'opStaan' to true, you also need to set it to false sometime before the (next day?) when you post(#opStaan) again.

    8 hours ago, Sjakie said:

    Jan, HC3 is doing some strange things?

    The messages are not correct.

    This rule is true

     

    Please login or register to see this code.

    In debug a lot of rules are marked true but the are not!

    Please login or register to see this attachment.

    What am I doing wrong?

    //Sjakie

    In a list you set ',' and not '&'.

    Please login or register to see this code.

     

    • Like 1
    Posted

    Jan, great will work it out.

    Question:

    Whats the diffrence between post and defTrigger?

    post can be ,+/00:25 in future.

    //Sjakie

     

  • Topic Author
  • Posted
    On 6/19/2021 at 2:08 PM, MARCUSP.I.L said:

    It is hard to test my ideas in emulator as the test time is 200 hours. Perhaps there is a setting that allows longer running time ?

    So, I had a look at the emulator and discovered that the speed time option had stopped working,. I have pushed a new version where it works better. (

    Please login or register to see this link.

    ).

    There you can set 

    if dofile and not hc3_emulator then
      hc3_emulator = {
        name="EventRunner4",
        credentials = { user = "ABC", ip = "192.168.1.57", pwd = "XYZ" },
        type="com.fibaro.genericDevice",
        poll=1000, 
        startTime="10:00:00 24/12/2021",
        speed = 200,

      }

      dofile("fibaroapiHC3.lua")
    end--hc3

     

    It will run 200 hours fast, starting on December 24th.

    How fast it will run depends a bit on the number of timers you have. The ER4 has a second timer that polls the HC3 and that slows it down (because it has to run the timers every second even if it's speeding).

    So, I have also pushed a new version of ER4 that if it runs in the emulator will behave better and not poll the HC3 as often (it will poll every second real time, and not the emulated fast time).

    Point being, if you download latest emulator and ER4 you will be able to speed the emulator and start at date where the sun is more troublesome. Btw, do you live in an area where the sun never goes up in the winter?

     

    2 minutes ago, Sjakie said:

    Jan, great will work it out.

    Question:

    Whats the diffrence between post and defTrigger?

    post can be ,+/00:25 in future.

    //Sjakie

     

    defTrigger is only to declare a variable that can act as a trigger. Meaning that if it appears to the left of '=>' in a rule it will trigger the rule if the variable change value. A 'normal' variable used to the left of '=>' will not trigger the rule if it changes value. By declaring them with defTrigger I know when I compile the rule to add code to trigger the rule when variable changes.

    post(<event>,<time>) just posts an event, now or a time in the future with +/<time>

    Posted (edited)

    Thanks Jan, is this a fix for emulator for eventrunner 3?  the file seems to suggest HC3 ?. Here in the winter Nov/Jan we get little daylight per say. . Sunset 15.30 sunrise 09.00. 

    I think i will try rules based on average sunset for months and use these sunset times as reference for actions. June and July are quite easy as they  differ by 15+ min for sunset times.

    The idea is :

    @rule nov (1-15) ...do that

    @rule nov (15-20) ...do that  

    etc etc for the darker months. Thanks again       

    Edited by MARCUSP.I.L
    Posted

    I have been using the following LUA code in my scenes for years to influence sunrise and sunset by creating a lookup table for the months. I call the scene every morning at 3:00 am to read the values. I then combine these with random numbers and my own sunrise / sunset. I have no idea whether you can use that in the ER4.

     

    Please login or register to see this code.

     

  • Topic Author
  • Posted
    2 hours ago, MARCUSP.I.L said:

    Thanks Jan, is this a fix for emulator for eventrunner 3?  the file seems to suggest HC3 ?. Here in the winter Nov/Jan we get little daylight per say. . Sunset 15.30 sunrise 09.00. 

    I think i will try rules based on average sunset for months and use these sunset times as reference for actions. June and July are quite easy as they  differ by 15+ min for sunset times.

    The idea is :

    @rule nov (1-15) ...do that

    @rule nov (15-20) ...do that  

    etc etc for the darker months. Thanks again       

    Ah, sorry, you are on a HC2. Ok, ignore my comment. (but I fixed a bug anyway :-) )

    Posted

    Guys thanks for the sunrise/ sunset discussiom.

    Finally I managed now a more simple schedule instead of 4 enormous rules for each season.

    Now its more fine tuned!

    Please login or register to see this code.

    #sunsetCorrectie will close curtains depends on % clouds

    Please login or register to see this code.

     

    #eveningCurtain will trigger light.
    Thanks again!
    //Sjakie
  • Topic Author
  • Posted
    32 minutes ago, jwi said:

    I have been using the following LUA code in my scenes for years to influence sunrise and sunset by creating a lookup table for the months. I call the scene every morning at 3:00 am to read the values. I then combine these with random numbers and my own sunrise / sunset. I have no idea whether you can use that in the ER4.

     

    Please login or register to see this code.

     

     

    In ER jwi's table would be something link below

    Please login or register to see this code.

     

    Posted

    Jan, about my arming messages I did the "," and it did not solved the problem off multiple msg.

    I remind you mentioned in trigger you need to wrap () and they must arm all together. can be triggy. That made me think further and the solution what is working is:

    Please login or register to see this code.

    At this moment I cant test the complete arming scene but one option is giving a single message.

    Only needs to find out if in App a partition is set to armed it will not show in proper way in ER4.

    The message partiton "x" is amed is comming trough.

    If I use the armed partition to switch security:on >>>>the arming QA will act as pinball machine

    I know this is to prevent human error it is messing system up.

    Herefor I will appriciate your input if its possible.

    Thanks!!,

    //Sjakie

    Posted

    Please login or register to see this code.

     

    I am trying to understand ER.

     

    I'm curious what the following command does.

     

    1. poll ??

    2. startTime ??

    3. speed ??

    4. offline ??

    5. profile ??

    6. Are there any additional options besides this?

  • Topic Author
  • Posted (edited)
    59 minutes ago, Earybeongbeong7 said:

    Please login or register to see this code.

     

    I am trying to understand ER.

     

    I'm curious what the following command does.

     

    1. poll ??

    2. startTime ??

    3. speed ??

    4. offline ??

    5. profile ??

    6. Are there any additional options besides this?

    This is not really  ER.  It's parameters for the emulator  (fibaroapiHC3.lua).

    It's ignored when run on. the HC3 as 

    Please login or register to see this code.

    is always false on the HC3

     

    There are a lot. of parameters -  from the documentation in fibaroapiHC3.lua:

    Please login or register to see this code.

     

    Edited by jgab
    Posted

    Jan this rule will post at the moment I switch spotvlag on for 'wed' true?

    and post(#vlagVerlUit)>>>switch spotvlag:off

    Should switch off at 23:26

     

    Please login or register to see this code.

     

     

  • Topic Author
  • Posted
    1 hour ago, Sjakie said:

    Jan this rule will post at the moment I switch spotvlag on for 'wed' true?

    and post(#vlagVerlUit)>>>switch spotvlag:off

    Should switch off at 23:26

     

    Please login or register to see this code.

     

     

    Nop, you can't use @<time> that way. Only one per rule.

    Please login or register to see this code.

     

    Posted
    16 hours ago, jgab said:

    This is not really  ER.  It's parameters for the emulator  (fibaroapiHC3.lua).

    It's ignored when run on. the HC3 as 

    Please login or register to see this code.

    is always false on the HC3

     

    There are a lot. of parameters -  from the documentation in fibaroapiHC3.lua:

    Please login or register to see this code.

     

     

    Thanks for the explanation. Also, is there a command to show the ER version as LOG?

     

    Posted

    I have:

    Please login or register to see this code.

    //Sjakie

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

     

    Thanks for the explanation. Also, is there a command to show the ER version as LOG?

     

    It's lua globals so this works

    Please login or register to see this code.

     

    Posted

    Thank you. ^^

     

    2 hours ago, Sjakie said:

    I have:

    Please login or register to see this code.

    //Sjakie

     

    2 hours ago, jgab said:

    It's lua globals so this works

    Please login or register to see this code.

     

     

    Please login or register to see this code.

     

     

    In what situations is this part used?

  • Topic Author
  • Posted
    3 hours ago, Earybeongbeong7 said:

    Thank you. ^^

    Please login or register to see this code.

    In what situations is this part used?

     

    Ok, so this is specific for ER4.

    The QA has a tight loop that reads system events from the /refreshStates api. It transforms some of these events to triggers in a similar format as the sourceTriggers we see in a Scene.'

    So, example the event that a binary device with ID 88 has turned on is represented as the trigger (lua table)

    {type='device', id = 88, property='value', value=true, old=false}

    The loop sends these events into the ER4 rule engine that then run relevant rules etc.

    Normally there are a lot of events/triggers generated so the self:enableTriggerType is a function that allow us to filter out triggers that we don't want to send to the ER4 rule engine. By being conservative here we can save some unnecessary computing and this lower the CPU load.

    The set of types enabled in your example is an ok standard set of triggers. If you never have any ER rules dealing with alarms you can exclude the "alarm" trigger in the declaration - just to save some CPU cycles.

    The types of triggers currently available is best viewed in the QA file Toolbox_triggers.

    At the moment they are

    Please login or register to see this code.

     

    ER allows you to write rules that trigger on these types even if there is no builtin support. For devices that are turned on one can use 88:isOn as a trigger

    rule("88:isOn => log('Light 88 turned on')")

    However we can also use

    rule("#device{id=88,property='value',value=true} => log('Light 88 turned on')")

     

    If want to trigger if scene 99 is started we can do

    rule("#sceneEvent{id=99,value='started'} => log('Scene 99 just started')")

    Note that we need to add "sceneEvent" to self:enableTriggerType or we will not get the trigger.

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