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

14 hours ago, jgab said:

 

Thanks, of course there were bugs. I edited the post.

 

This is actually very difficult (but I have a partial solution).

 

{id1,id2}:property is translated to {id1:property, id2:property}, i.e. the result is a table.

so what you get in your example is a table with the buttonevent properties for 35002 and 35003. Ex. {4003, 1002} - and it will not match 4003.

To just test if 4003 is part of that table is not working either, because it could have been the button generating 1002 that triggered the event, and 4003 is an "old" state.

:allOn and :anyOff are exceptions, as they check if all values in the table is 'true' or if any value in the table is 'true' respectively. It makes sense for lights and motion sensors as this is operations you often want - but it doesn't make sense for key presses as explained, because we only want to test the device that triggered the event.

 

So, I propose this hack. I have made a new property named ':dID' (think 'deviceID').

The semantic of that property applied to a table if IDs is to look through the table and return the ID that matches the env.event.deviceID property. If there is no env.event or env.event.deviceID it's just a nop, and will return the table.

Please login or register to see this code.

This will work because {35002,35003}:dID will return the id that caused the event, and then we apply the ':buttonevent' on that id, and it will return the single value.

So it's not a complete solution, ':dID' only works on {type='property', deviceID=...} type of events.

 

I have pushed the new version.

 

 

I can confirm that property dID works as expected.

Thanks!

Link to comment
Share on other sites

7 hours ago, jompa68 said:

I will setup a seperated watchdog scene to monitor all ER scene

ok, i have now a separated scene for this. Added below code to ER main scene 

Please login or register to see this code.

I get PONG back from scene but ER main say this error message

Please login or register to see this code.

 

Link to comment
Share on other sites

  • Topic Author
  • 1 hour ago, jompa68 said:

    ok, i have now a separated scene for this. Added below code to ER main scene 

    Please login or register to see this code.

    I get PONG back from scene but ER main say this error message

    Please login or register to see this code.

     

     

    I'm really sorry - somehow the PING handler had turn sour... It should look like this. It could also solve @petrkl12 issues

    Please login or register to see this code.

    I have fixed in the version I just pushed.

    The pinger should look like below (It's not included in ER by default) - it's the same as in the Oct.25 post

    Please login or register to see this code.

    If there are event posts that you don't want to log (like the PING/PONG above), one can add a ._sh=true field in the event and the post will not log it. I use it for some internal events that is not useful to have in the log. 

    I changed the code to depend on _debugFlags.ping to log events in the ping code. Set _debugFlags.ping=true to get full log, otherwise only when scene needs to be restarted. One could add a notification to the phone too, because this should not happen...

    Edited by jgab
    Link to comment
    Share on other sites

    Hi, 
    i'm trying to run EventRunner Demo mode on my PC , and got this error message :

     

    Program starting as '"C:\Users\Dominik\Downloads\ZeroBraneStudio\bin\lua.exe" -e "io.stdout:setvbuf('no')" "C:\Users\Dominik\Desktop\EventRunner-master\EventRunner.lua"'.
    Program 'lua.exe' started in 'C:\Users\Dominik\Desktop\EventRunner-master' (pid: 18044).
    12:01:56:[33mTue Jan 22: Demo - EventRunner v1.11[0m
    12:01:56:[32mTue Jan 22: Sunrise 08:19, Sunset 15:40[0m
    12:01:56:[32mTue Jan 22: Starting:01/22/19 12:01:56, Ending:03/23/19 12:01:56 [0m
    12:01:56:[32mTue Jan 22: Emulating local Fibaro API[0m
    12:01:56:[32mTue Jan 22: Remote Event listener started at 192.168.1.137:6872[0m
    12:01:56:[32mTue Jan 22: Hue system inited (experimental)[0m
    12:01:56:[35mTue Jan 22: [0m
    12:01:56:[35mTue Jan 22: Loading rules[0m
    12:01:56:[35mTue Jan 22: Initiated 1 globals from 'globals.data'[0m
    12:01:56:[31mTue Jan 22: Error loading rules:example_rules.lua:39: attempt to call global '_setClock' (a nil value)[0m
    Program completed in 0.05 seconds (pid: 18044).

     

    I downloaded the latest version from GitHub.

    Could You help me figure this out ?

    regards

    Link to comment
    Share on other sites

  • Topic Author
  • 17 minutes ago, domin12 said:

    Hi, 
    i'm trying to run EventRunner Demo mode on my PC , and got this error message :

     

    Program starting as '"C:\Users\Dominik\Downloads\ZeroBraneStudio\bin\lua.exe" -e "io.stdout:setvbuf('no')" "C:\Users\Dominik\Desktop\EventRunner-master\EventRunner.lua"'.
    Program 'lua.exe' started in 'C:\Users\Dominik\Desktop\EventRunner-master' (pid: 18044).
    12:01:56:[33mTue Jan 22: Demo - EventRunner v1.11[0m
    12:01:56:[32mTue Jan 22: Sunrise 08:19, Sunset 15:40[0m
    12:01:56:[32mTue Jan 22: Starting:01/22/19 12:01:56, Ending:03/23/19 12:01:56 [0m
    12:01:56:[32mTue Jan 22: Emulating local Fibaro API[0m
    12:01:56:[32mTue Jan 22: Remote Event listener started at 192.168.1.137:6872[0m
    12:01:56:[32mTue Jan 22: Hue system inited (experimental)[0m
    12:01:56:[35mTue Jan 22: [0m
    12:01:56:[35mTue Jan 22: Loading rules[0m
    12:01:56:[35mTue Jan 22: Initiated 1 globals from 'globals.data'[0m
    12:01:56:[31mTue Jan 22: Error loading rules:example_rules.lua:39: attempt to call global '_setClock' (a nil value)[0m
    Program completed in 0.05 seconds (pid: 18044).

     

    I downloaded the latest version from GitHub.

    Could You help me figure this out ?

    regards

    I'm sorry, it's an old version of example_rules.lua. _setClock has been replaced with   _System.setTime.

    I pushed the new version of example_rules.lua to GitHub 

    Link to comment
    Share on other sites

  • Topic Author
  • 38 minutes ago, jgab said:

    I'm sorry, it's an old version of example_rules.lua. _setClock has been replaced with   _System.setTime.

    I pushed the new version of example_rules.lua to GitHub 

     

    Btw, when running the example_rules I recommend to enable _SPEEDTIME=24*36, more fun that way :-) 

    Link to comment
    Share on other sites

  • Topic Author
  • So, ':dID' works also for CentralSceneEvent and AccessControlEvent.

    So this works

    Please login or register to see this code.

    dID used to select the id that caused the event.

    Previously we sorted CentralSceneEvent and AccessControlEvent events on timestamp so that

    Please login or register to see this code.

    ...so that selecting the first on the table worked - this does not work any more. Please use :dID instead.

    Link to comment
    Share on other sites

    Looks like nodered function have been changed, to not working in 1.11

     

    Old line

    Please login or register to see this code.

    New line, correct?

    Please login or register to see this code.

    Sorry, it did work. My mistake :rolleyes:

    Edited by jompa68
    Link to comment
    Share on other sites

    @jgab

    this doesn't work in new version. Originally I had it without :dID:   -   Obyvacipokoj.Tlacitko4tlobyv:central => ...

    Please login or register to see this code.

    Error in ' Event.event({"type":"event","event":{"type":"$t","data":"$data"}},...)': /opt/fibaro/scenes/217.lua:1827: attempt to index global '_getEID' (a nil value)

     

    What should be correct syntax?

    Edited by petrkl12
    Link to comment
    Share on other sites

    Also got some new error now, command that did work in 1.11 fix 9

    Please login or register to see this image.

    /monthly_2019_01/240354209_Skrmavbild2019-01-23kl_05_22_50.png.69e1db002a9ca31a098a5fa8bd4b0b20.png" alt="240354209_Skrmavbild2019-01-23kl_05_22_50.png.69e1db002a9ca31a098a5fa8bd4b0b20.png" />

    Link to comment
    Share on other sites

    16 hours ago, jgab said:

    dID used to select the id that caused the event.

    Previously we sorted CentralSceneEvent and AccessControlEvent events on timestamp so that

    ...so that selecting the first on the table worked - this does not work any more. Please use :dID instead.

    Ok this will solve my problem with swipe, but 2:nd error in my picture. What could that be?

    Link to comment
    Share on other sites

  • Topic Author
  • I managed to push the wrong version (with '_getEID') - now there is a version where central/access should work.

    @jompa68, your second error doesn't seem to be related to that. Can you give me the code lines around 1270 and 1197?

    Edited by jgab
    Link to comment
    Share on other sites

  • Topic Author
  • 2 hours ago, jompa68 said:

    Ok this will solve my problem with swipe, but 2:nd error in my picture. What could that be?

    If I try to run this on ZBS I don't get errors

    Please login or register to see this code.

    and the 'compare nil with number' error is usually caused by a '>' or '<' comparison - which is not obvious where it would come from in this rule either.

    Actually, it could happen if the argument to wait is nil wait(nil). It looks ok in your code but could there be some strange invisible character in the wait arguments?

    The 05:00..07:00 can also give this error if one of  05:00 or 07:00 is not recognised as a time constant - which could happen with invisible characters sneaking into the code. If this turn out to be the problem, maybe I can add a filter in the rule command to catch these...

    Edited by jgab
    Link to comment
    Share on other sites

  • Topic Author
  • 2 hours ago, jompa68 said:

    Ok this will solve my problem with swipe, but 2:nd error in my picture. What could that be?

     

    Pushed yet another version fix12.

    If you do like this

    Please login or register to see this code.

    e.g. assign the result of the rule command that gives problem, and then call ScriptCompiler.dum(a._code) you get a printout of the "assembler" of the script rule. It may not make a lot of sense to you but have a look if some of the time constants look like nil - then there is something strange with the source code for that. Or post it back to me and I can check.

    When I run it it looks like this (and it runs ok). It has the 05:00 (18000) and the 07:00 (25200) and the two 00:00:03 (3) time/0 instructions.

    Please login or register to see this code.

     

    If nothing looks out of order, do

    Please login or register to see this code.

    and give me the trace output in a PM.

    'trace(false)' turns off tracing.

    Edited by jgab
    Link to comment
    Share on other sites

    hi @jgab

    i've got a VD where i can chang time to open or close my blinds, the time is calculated in this VD based on sunset and sunrise time , it's different every day.

    and now i'm trying to use this :

    Rule.eval("@time($BlindTimeC) => log('It's morning!')") 

    Rule.eval("@time($BlindTimeO) => log('It's morning!')") 

     

    and it worked only one time, could you help me with this ?

    Edited by domin12
    Link to comment
    Share on other sites

  • Topic Author
  • 1 hour ago, domin12 said:

    hi @jgab

    i've got a VD where i can chang time to open or close my blinds, the time is calculated in this VD based on sunset and sunrise time , it's different every day.

    and now i'm trying to use this :

    Rule.eval("@time($BlindTimeC) => log('It's morning!')") 

    Rule.eval("@time($BlindTimeO) => log('It's morning!')") 

     

    and it worked only one time, could you help me with this ?

    Hi, daily rules (@ rules), are scheduled every midnight for the day to come. This means that your rule will only schedule for the new time set in your VD at the next midnight.

    You could do the calculation in the scene, but I guess you may have some user input from the VD being part of the calculation.

    If the $BlindTimeC string is on the format "n/07:00", i.e. the "n/" prefix which means the next time or next day if passed, something like this could work - where you do your own scheduling (haven't the opportunity to test it at the moment).

    Please login or register to see this code.

    I guess there should be a way to restart a daily rule, but the internal logic is not setup to allow for that easily. I will put that on my ToDo list.

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

    Godzinę temu, jgab napisał:

    Hi, daily rules (@ rules), are scheduled every midnight for the day to come. This means that your rule will only schedule for the new time set in your VD at the next midnight.

    You could do the calculation in the scene, but I guess you may have some user input from the VD being part of the calculation.

    If the $BlindTimeC string is on the format "n/07:00", i.e. the "n/" prefix which means the next time or next day if passed, something like this could work - where you do your own scheduling (haven't the opportunity to test it at the moment).

    Please login or register to see this code.

    I guess there should be a way to restart a daily rule, but the internal logic is not setup to allow for that easily. I will put that on my ToDo list.

     

    Thank You very much for quick respond,

    Unfortunately, nothing happens when the value has been changed by VD, it's look like the scene doesn't see the changes in BlindTimeC variable.

    this is my activation part of the scene :

    --[[
    %% properties
    992 value
    1035 value
    %% events
    %% globals
    counter
    %% autostart
    --]]

     

    Link to comment
    Share on other sites

  • Topic Author
  • 1 minute ago, domin12 said:

     

    Thank You very much for quick respond,

    Unfortunately, nothing happens when the value has been changed by VD, it's look like the scene doesn't see the changes in BlindTimeC variable.

    this is my activation part of the scene :

    --[[
    %% properties
    992 value
    1035 value
    %% events
    %% globals
    counter
    %% autostart
    --]]

     

    Add BlindTimeC under %% globals

    • Like 1
    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...