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

@jgab, I have got some basic things running now! It works very nice :)

 

Would you have a suggestion on how to slowly reduce light intensity over time when no activity is detected?

 

rationale:

- light is turned on at level A

- no motion detected for 10 mins in room?  --> start reducing intensity, e.g. step by step over period of 10 mins to level B

- no motion detected for 20 mins in room?  --> start reducing intensity, e.g. step by step over period of 10 mins to level C

- motion detected, but single motion? --> increase back to level B or stay at level B

- repeated motion detected --> increase to level A

 

 

Link to comment
Share on other sites

  • Topic Author
  • I would probably do it like this. Note, I had to add a round() function so I have pushed a new version to GitHub.

    Please login or register to see this code.

    So, if the dim value is >= level B when the sensor is breached it jumps to level A. If it is less than level B it jumps to level B.

    When the sensor becomes safe it waits 10min and starts to dim in steps. First in the dim1 loop, and then in the dim2 loop. If breached it starts over.

    The 10 minutes are divided up in 1min steps. Easy to change that into smaller steps if needed.

    Edited by jgab
    Link to comment
    Share on other sites

    Great @jgab! I should be able to make that work. Thanks again for your time.

     

    One other question: I did get a "Too many instances" error for this scene. I wasn't expecting this as it is supposed to run only one instance, right? Or do triggers cause new instances which are then cancelled?

    I had the max number set to 4 and will now increase it to 10. Please let me know if that is the wrong thing to do.

    J

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    Latest version gives an error, see picture

     

    Please login or register to see this image.

    /monthly_2018_08/image.png.93b98f26bb29eda6dfc266b9059f560c.png" alt="image.png.93b98f26bb29eda6dfc266b9059f560c.png" />

    Link to comment
    Share on other sites

  • Topic Author
  • On 8/27/2018 at 4:38 PM, jompa68 said:

    Latest version gives an error, see picture

     

    Please login or register to see this link.

     

    Maybe I fixed it - did you up the debug level to 4 or more? I had a format statement that only had  '%' ... the bug been there for ages. Fixed in the last Github commit.

    Link to comment
    Share on other sites

  • Topic Author
  • On 8/26/2018 at 1:15 PM, 3JL said:

    Great @jgab! I should be able to make that work. Thanks again for your time.

     

    One other question: I did get a "Too many instances" error for this scene. I wasn't expecting this as it is supposed to run only one instance, right? Or do triggers cause new instances which are then cancelled?

    I had the max number set to 4 and will now increase it to 10. Please let me know if that is the wrong thing to do.

    J

    Please login or register to see this attachment.

    I usually set it to 10. It needs 1+(number of parallell triggers). Yes, a new trigger is handled in a new instance that just "post" the sourceTrigger datastructure to global "mailbox" variable and then terminates. These instances are very short-lived and even if I have a lot of reporting devices I have never been close to hitting the 10 roof...

    • Thanks 1
    Link to comment
    Share on other sites

    On 8/30/2018 at 2:01 PM, jgab said:

     

    Maybe I fixed it - did you up the debug level to 4 or more? I had a format statement that only had  '%' ... the bug been there for ages. Fixed in the last Github commit.

     

    please correct your code in this line, thanks :)

     

        Debug(4,"Incoming event:%",l)
    with

        Debug(4,"Incoming event:%s",l)
     

     

    Link to comment
    Share on other sites

  • Topic Author
  • 4 hours ago, petrkl12 said:

     

    please correct your code in this line, thanks :)

     

        Debug(4,"Incoming event:%",l)
    with

        Debug(4,"Incoming event:%s",l)
     

     

    That was what I thought I had done! Seems like it didn't stick. Ok, write once, commit twice :-)

    Anyway,  updated now.

    Thanks /J

    Link to comment
    Share on other sites

    Your framework EventRunner is super!

     

    I have my own virtual device for Philips Hue dimmer switch - and there are two labels that I want to use in your framework

    1. label where is date and time when last button was pressed

    2. ID of button that was pressed i.e. 4001 short press of button ON

     

    So I need create rules for reaction on different  button ID. Could you help me?

     

     

     

    Link to comment
    Share on other sites

  • Topic Author
  • 2 minutes ago, petrkl12 said:

    Your framework EventRunner is super!

     

    I have my own virtual device for Philips Hue dimmer switch - and there are two labels that I want to use in your framework

    1. label where is date and time when last button was pressed

    2. ID of button that was pressed i.e. 4001 short press of button ON

     

    So I need create rules for reaction on different  button ID. Could you help me?

     

     

     

     

    I'm not sure I understod exactly...

    So you have a VD with buttons that you control a Philips Hue with. and you want to trigger rules in the EventRunner scene when you press buttons on that VD?

     

    When buttons are pressed on VDs there are no (device) triggers sent to scenes.

    However, in the lua script for VD button you could send an event to the EventRunner scene when you turn on or off the Hue light.

    So in the VD, in the lua script for the button(s) you can send an event to the EventRunner scene by doing this

    Please login or register to see this code.

    and in the EventRunner scene you will get the event sent from the VD and can make a rule like this to trigger when button is pressed on the VD

    Please login or register to see this code.

    or with the script language

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    Thanks but I have used bad explanation of my problem ...

     

    Hue dimmer switch is real device with 4 buttons and I have virtual device that detects events from this device (see in picture) to have possibility to use it also for non Hue devices that is connected to Fibaro.

     

    Please login or register to see this image.

    /monthly_2018_09/HueDimmerSwitchVD.png.752a4f785d632c5ba056f24a9362867c.png" />

     

    In standard scene I use following calling:

    Please login or register to see this code.

    I would like to use it in your framework.

    I have tried this rule but it doesn't work

    Please login or register to see this code.

     

    Edited by petrkl12
    Link to comment
    Share on other sites

  • Topic Author
  • 10 hours ago, petrkl12 said:

    Thanks but I have used bad explanation of my problem ...

     

    Hue dimmer switch is real device with 4 buttons and I have virtual device that detects events from this device (see in picture) to have possibility to use it also for non Hue devices that is connected to Fibaro.

     

    Please login or register to see this link.

     

    In standard scene I use following calling:

    Please login or register to see this code.

    I would like to use it in your framework.

    Ok, I get it.

    I'm not a big user of VDs so the support for label/slider triggers were minimal. I have pushed a new version to GitHub so this should work (I hope I didn't break anything else ;-) )

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

  • Topic Author
  • 10 hours ago, petrkl12 said:

    Thanks but I have used bad explanation of my problem ...

     

    Hue dimmer switch is real device with 4 buttons and I have virtual device that detects events from this device (see in picture) to have possibility to use it also for non Hue devices that is connected to Fibaro.

     

    Please login or register to see this link.

     

    In standard scene I use following calling:

    Please login or register to see this code.

    I would like to use it in your framework.

    I have tried this rule but it doesn't work

    Please login or register to see this code.

     

     

    Actually, looking back at your original attempt you were close but 'event trigger' rules, rules starting with '#', can not have any other tests on the left hand of the '=>', and when you test the label value you should use '==' not '=', the latter is asignment.

    So I guess that 

    Please login or register to see this code.

    would have worked. But the solution in my previous post is better/cleaner.

    Edited by jgab
    Link to comment
    Share on other sites

    I have tried your new version and it still not work....

     

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

  • Topic Author
  • 6 minutes ago, petrkl12 said:

    I have tried your new version and it still not work....

     

    Please login or register to see this code.

     

    Hos does your scene header declaration look like? (%% properties etc...)

    Link to comment
    Share on other sites

    --[[
    %% properties
    860 ui.lblLastAction.value
    %% events
    %% globals
    counter
    --]]
     

    it detects device id 860 ..

    log:

    [DEBUG] 22:14:35: Incoming event:{"deviceID":860,"propertyName":"ui.lblLastAction.value","type":"property"}

     

    I use different labels for detection of event and different label for comparing because in label for detection there is time of last pressed button and in comparing label there is ID of button.

    I think it should be OK

     

     

    Link to comment
    Share on other sites

  • Topic Author
  • 7 hours ago, petrkl12 said:

    --[[
    %% properties
    860 ui.lblLastAction.value
    %% events
    %% globals
    counter
    --]]
     

    it detects device id 860 ..

    log:

    [DEBUG] 22:14:35: Incoming event:{"deviceID":860,"propertyName":"ui.lblLastAction.value","type":"property"}

     

    I use different labels for detection of event and different label for comparing because in label for detection there is time of last pressed button and in comparing label there is ID of button.

    I think it should be OK

     

     

    Ok, it means that the rule is triggered.. When I try something similar it works for me so I'm missing something you do. Try this and se what you get.

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    only last rule is working (I have tried different buttons):

     

    Rule.eval("#property{deviceID=860} & label(860,'lblButtonID')=='4003' => log('Button Off 1')")
    Rule.eval("#property{deviceID=860} => label(860,'lblButtonID')=='4003' => log('Button Off 2')")
    Rule.eval("#property{deviceID=860} || label(860,'lblButtonID')=='4003' >> log('Button Off 3')")
    Rule.eval("#property{deviceID=860} & label(860,'lblButtonID')=='4003' => log('Button Off 4')")
    Rule.eval("#property{deviceID=860} => log('lblLastAction=%s, lblButtonID=%s',label(860,'lblLastAction'),label(860,'lblButtonID'))")

     

    log:

    [DEBUG] 06:48:41: Incoming event:{"deviceID":860,"propertyName":"ui.lblLastAction.value","type":"property"}
    [DEBUG] 06:48:41: lblLastAction=04.09.2018 06:48:36, lblButtonID=4002
    [DEBUG] 06:48:49: Incoming event:{"type":"property","propertyName":"ui.lblLastAction.value","deviceID":860}
    [DEBUG] 06:48:49: lblLastAction=04.09.2018 06:48:46, lblButtonID=4003
    [DEBUG] 06:49:01: Incoming event:{"propertyName":"ui.lblLastAction.value","type":"property","deviceID":860}
    [DEBUG] 06:49:01: lblLastAction=04.09.2018 06:48:57, lblButtonID=1003
    [DEBUG] 06:49:13: Incoming event:{"propertyName":"ui.lblLastAction.value","type":"property","deviceID":860}
    [DEBUG] 06:49:13: lblLastAction=04.09.2018 06:49:05, lblButtonID=1002
     

    Link to comment
    Share on other sites

  • Topic Author
  • 3 minutes ago, petrkl12 said:

    only last rule is working (I have tried different buttons):

     

    Rule.eval("#property{deviceID=860} & label(860,'lblButtonID')=='4003' => log('Button Off 1')")
     Rule.eval("#property{deviceID=860} => label(860,'lblButtonID')=='4003' => log('Button Off 2')")
    Rule.eval("#property{deviceID=860} || label(860,'lblButtonID')=='4003' >> log('Button Off 3')")
    Rule.eval("#property{deviceID=860} & label(860,'lblButtonID')=='4003' => log('Button Off 4')")
    Rule.eval("#property{deviceID=860} => log('lblLastAction=%s, lblButtonID=%s',label(860,'lblLastAction'),label(860,'lblButtonID'))")

     

    log:

    [DEBUG] 06:48:41: Incoming event:{"deviceID":860,"propertyName":"ui.lblLastAction.value","type":"property"}
    [DEBUG] 06:48:41: lblLastAction=04.09.2018 06:48:36, lblButtonID=4002
    [DEBUG] 06:48:49: Incoming event:{"type":"property","propertyName":"ui.lblLastAction.value","deviceID":860}
    [DEBUG] 06:48:49: lblLastAction=04.09.2018 06:48:46, lblButtonID=4003
    [DEBUG] 06:49:01: Incoming event:{"propertyName":"ui.lblLastAction.value","type":"property","deviceID":860}
    [DEBUG] 06:49:01: lblLastAction=04.09.2018 06:48:57, lblButtonID=1003
    [DEBUG] 06:49:13: Incoming event:{"propertyName":"ui.lblLastAction.value","type":"property","deviceID":860}
    [DEBUG] 06:49:13: lblLastAction=04.09.2018 06:49:05, lblButtonID=1002
     

    Ok, the first four rules have wrong syntax (I will do a post explaining the script syntax better).

    It should work if you do this

    Please login or register to see this code.

    or this

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    I think this will change label for lblButtonID to value 4003 but I need test value not change it ...

    Rule.eval("#property{deviceID=860} => label(860,'lblButtonID')=='4003' & log('Button Off 1')")
     

    this rule is without reaction as you can see in log

    Rule.eval("#property{deviceID=860} => || label(860,'lblButtonID')=='4003' >> log('Button Off 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...