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

  • Topic Author
  • Posted (edited)
    52 minutes ago, petrkl12 said:

    OK thanks a lot for your support !

     

    but there are more same names for scenes in one hub as you can see:

     

    Oh, that's bad. Wonder how Philips were thinking? If you have the same name and the same picture and the same lights in the scene you can't tell hem apart in the App?

    The only unique is the scene ID that is not very user friendly - do you have an idea how to map scenes? I guess we could allow the scene id but it's a bit ugly.

    Currently I filter out scenes with version < 2 because my scenes with id 1 looked very strange (old) so I thought they were left overs from a previous bridge I had.

     

     

    Quote

     

     I'm wating for 3 years ... but still nothing btw. based on developers pages this is most wanted functionality ...

     

    Hopefully we will have it soon then? :-) 

     

    Ok, pushed a version that supports Hue scene IDs

    <id>:value=<string> 

    I first try to get a scene with the name <string>, and if not found uses the <string > as the scene id. The scene ID would not clash with the scene name so that should work.

    Please login or register to see this code.

    It's bad that there is no way to search/find scene IDs from more user friendly names.

    Edited by jgab
  • Topic Author
  • Posted

    Maybe it's smarter to integrate with 

    Please login or register to see this link.

     running on node-red?

    They seems to be able to get events from devices (don't know if they poll or do something else). It would off-load the HC2 too.

     

    Posted
    1 hour ago, jgab said:

     

    Oh, that's bad. Wonder how Philips were thinking? If you have the same name and the same picture and the same lights in the scene you can't tell hem apart in the App?

    The only unique is the scene ID that is not very user friendly - do you have an idea how to map scenes? I guess we could allow the scene id but it's a bit ugly.

    Currently I filter out scenes with version < 2 because my scenes with id 1 looked very strange (old) so I thought they were left overs from a previous bridge I had.

     

     

    Hopefully we will have it soon then? :-) 

     

    Ok, pushed a version that supports Hue scene IDs

    <id>:value=<string> 

    I first try to get a scene with the name <string>, and if not found uses the <string > as the scene id. The scene ID would not clash with the scene name so that should work.

    Please login or register to see this code.

    It's bad that there is no way to search/find scene IDs from more user friendly names.

     

    Perfect, thanks

  • Topic Author
  • Posted
    16 minutes ago, jgab said:

    Maybe it's smarter to integrate with 

    Please login or register to see this link.

     running on node-red?

    They seems to be able to get events from devices (don't know if they poll or do something else). It would off-load the HC2 too.

     

    They seem to poll too...

    26 minutes ago, jgab said:

    They seem to poll too...

    Well, it seems like sensors are not polled (?) and I get quite immediate responses. It could turn out that a node-red integration of sensors is the best approach. Lights and Groups are polled and that may be ok.

    Posted
    48 minutes ago, jgab said:

    They seem to poll too...

    Well, it seems like sensors are not polled (?) and I get quite immediate responses. It could turn out that a node-red integration of sensors is the best approach. Lights and Groups are polled and that may be ok.

    It's interesting. How do you think that it's implemented? 

    Currently I don't use node-red ...

    Posted

    @jgab

    Could you please add support for table in Hue.monitor? 

    Thanks

     

  • Topic Author
  • Posted
    30 minutes ago, petrkl12 said:

    @jgab

    Could you please add support for table in Hue.monitor? 

    Thanks

     

    Ok, fixed and pushed

    1 hour ago, petrkl12 said:

    It's interesting. How do you think that it's implemented? 

    Currently I don't use node-red ...

    Looking at the code, and they are polling - polling lights, sensors and groups separately. Can be 500ms but they recommend 1000-5000.

    I'm more worried about the HC2 then the Hue hub, so it could be good to have another node do the polling.

    Posted

    thanks

     

    In my current solution I have 500ms for sensors and 5000ms for lights and groups for 4 bridges and HC2 is OK :) (I do polling for all sensors, lights and groups)

  • Topic Author
  • Posted
    25 minutes ago, petrkl12 said:

    thanks

     

    In my current solution I have 500ms for sensors and 5000ms for lights and groups for 4 bridges and HC2 is OK :) (I do polling for all sensors, lights and groups)

     

    Great, I think I can do polling more efficient.

    Posted (edited)

    what I also do is extra polling if I know that something happend what could influence lights or groups state ie. change state for some sensors (buttons) or change state in VDs for hue lights/groups. it means stopping current timer, do polling and set timmer for next regular period for lights and groups.

    Edited by petrkl12
  • Topic Author
  • Posted (edited)

    Another cool hack one can do is to use EventRunner as a very flexible scheduler for standard H2C scenes.

    Create an EventRunner scene with the following main():

    Please login or register to see this code.

    When that scenes starts up it will look through all scenes on the HC2 and their headers, if it sees a scene looking like this:

    Please login or register to see this code.

    If there is a "%% eventrules" header it will take the eventscript rules declared afterward and evaluate them. 'SCENE' is replaced with the scenes id, and if there is no "=>" in the eventscript it will add " => SCENE:start" at the end of the rule.

    This means that this scene will be started at 10:00 every day, and at sunset+10min every Saturday. In the latter case it gets the argument {'sunset'} too. 

    A very simple way to write scenes that should be scheduled at various times and under different conditions. 

    The only trick is that the EventRunner scene needs to be restarted when a scene's header is changed so that it will reparse the scene headers and set up the new rules.

    Edited by jgab
    • Like 1
    Posted

    Unbelievable what is possible to do with EventRunner, thanks!

    Posted

    @jgab

     

    Could you please add hue support for table in this case:

    Please login or register to see this code.

     

    Posted
    12 hours ago, jgab said:

    A very simple way to write scenes that should be scheduled at various times and under different conditions. 

    @jgab, not sure your "hack" is working, at least not for me. Not writing out the rule in mainscene.

     

    Please login or register to see this image.

    /monthly_2019_01/eventrunner.png.02223da89e2396fb4858e1e3282b84c7.png" alt="eventrunner.png.02223da89e2396fb4858e1e3282b84c7.png" />20190121_07-00-25.png.0c59e9e19e2d1b3de8835f057f41557f.png

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

    @jgab, not sure your "hack" is working, at least not for me. Not writing out the rule in mainscene.

    Please login or register to see this link.

     

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

    10 hours ago, petrkl12 said:

    @jgab

     

    Could you please add hue support for table in this case:

    Please login or register to see this code.

     

     

    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.

     

    Posted

    thanks, i will try it tonight.

    Posted

    Still some error @jgab

     

    Please login or register to see this code.

    Notice another thing today when i did arrive home, no lights did turn on. Checking scene and did see it 10 instance running. How come?

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

    Still some error @jgab

     

    Please login or register to see this code.

    Notice another thing today when i did arrive home, no lights did turn on. Checking scene and did see it 10 instance running. How come?

     

    The first error is strange - looks like it finds '%%event rules' but no rules - let me think about that...

    The second error with EventRunner stopping and piling up instances I haven't seen for a year. Used to be a problem when HC2 silently crashed in json.decode/encode some versions ago. What happened was that the loop that reads incoming events crashed which resulted in that behaviour. 

    Did you get any error message in the log?

    Anyway, see if it happens again and I will have a look into it. 

    Sometimes it can also happen if one presses 'start' more than once for the scene - I will see if I can detect that and handle it more graceful.

  • Topic Author
  • Posted
    19 minutes ago, jgab said:

     

    The first error is strange - looks like it finds '%%event rules' but no rules - let me think about that...

    The second error with EventRunner stopping and piling up instances I haven't seen for a year. Used to be a problem when HC2 silently crashed in json.decode/encode some versions ago. What happened was that the loop that reads incoming events crashed which resulted in that behaviour. 

    Did you get any error message in the log?

    Anyway, see if it happens again and I will have a look into it. 

    Sometimes it can also happen if one presses 'start' more than once for the scene - I will see if I can detect that and handle it more graceful.

     

    Btw, if you have implemented the "ping" mechanism it shouldn't answer and be restarted - that is what I used to do when json crashed but I haven't needed it for +6month now.

    Posted

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

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