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
    1 minute ago, jompa68 said:

    We arr talking about ms so not a big issie

    No, and we typically only do it once at startup of a scene.

    Posted

    in iOSLocator i got this error when i set my scene number to _deviceTable

     

    Please login or register to see this code.

     

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

    in iOSLocator i got this error when i set my scene number to _deviceTable

     

    I missed copy over the startup rule. I fixed it and pushed a new version.

    Posted
    21 hours ago, petrkl12 said:

    And also I have huge scene for detecting any movement in my house/floors/rooms (all motion detectors, switches, door/window sensors, CO2 growth ...) and via that i will be able to split it into more scenes.

    Like this idea, then you don't need to declare same id in header in the other scenes, just use #subscribe.

    4 minutes ago, jgab said:

     

    I missed copy over the startup rule. I fixed it and pushed a new version.

    Thanks :)

  • Topic Author
  • Posted

    Ok, there is an issue with the current version of Supervisor (and iOSLocator). 

    If you run ZeroBrane studio and have _REMOTE enabled and run some EventRunner based scene, the Supervisor on the HC2 gets notified that there is new scene but because it's not there it gets crazy and starts multiple instances of itself - and multiple instances of the Supervisor makes a mess as not all instances may get 'pong' back from other scenes resulting in scenes being killed and eventually deactivated.

    I have pushed a fix for Supervisor.lua and iOSLocator.lua.

     

    At the moment offline scenes and scenes on the HC2 doesn't play together that well. However,  I'm looking into it and hope that things like publish/subscribe should work between them.

     

    Posted
    1 minute ago, jgab said:

    If you run ZeroBrane studio and have _REMOTE enabled and run some EventRunner based scene, the Supervisor on the HC2 gets notified that there is new scene but because it's not there it gets crazy and starts multiple instances of itself - and multiple instances of the Supervisor makes a mess as not all instances may get 'pong' back from other scenes resulting in scenes being killed and eventually deactivated.

    Ah! Thats why my HC2 did goes bananas yesterday evening.

     

  • Topic Author
  • Posted (edited)
    23 minutes ago, jompa68 said:

    Ah! Thats why my HC2 did goes bananas yesterday evening.

     

    Yes, for me too. I couldn't understand what was happening and it took me a while to realise that it depended on what I was running on ZBS. The bug has always been there but it was only now when I implemented publish/subscribe that a scenes started to broadcast announce messages when started up. Also scenes running offline.

     

    With the fix, the scene will just log that it "is already started". The bug was  that when, fibaro:startScene is running offline it doesn't take arguments (just discovered it).That means that Supervisor got an "other" sourcetrigger and without arguments and started a new instance. (now it checks for that, standard EventRunner scenes already do that test)

     

    I have so far relied on including FibaroSceneAPI.lua and intercepted the fibaro:* commands when I needed. When _REMOTE is enabled the FibaroSceneAPI.lua functions run as is and most commands goes to the HC2. When _REMOTE is false I intercept the commands and run things locally. I'm thinking about including my own version of that code into EventRunnerDebug.lua now (and also fix fibaro:startScene) because we would like to do something in-between when some commands goes to the HC2 and some locally - especially if we want local and offline scenes to communicate.   

    Edited by jgab
    Posted

    Testing some functions and looks like average is not working like it should. I think average value should be 70 after my 3 postings

    Please login or register to see this code.

    Please login or register to see this code.

     

    Posted

    @jgab

     

    Can I use this pattern?

    Please login or register to see this code.

     

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

    @jgab

     

    Can I use this pattern?

    Please login or register to see this code.

     

    You should.

    Please login or register to see this code.

    is a shortcut for

    Please login or register to see this code.

    so if the publisher publish an event with deviceID 100,101 or 102 you get a match on the receiving side. However, the publisher is allowed to publish events with other deviceIDs to you, anything that matches #VirtualSwitch{}.

    However, he can't do

    Please login or register to see this code.

    which is not allowed with a regular Event.post either.

    Posted

    OK, thanks

     

    but it looks that it doesn't work, could you please check it?

     

    Please login or register to see this code.

     

    this is also OK

    Please login or register to see this code.

     

  • Topic Author
  • Posted

    Ah, but the pattern/hack #event{device=<table of IDs>} only works for event of type 'property'. I guess I could extend it to any type of event. However that means you can't have any event with field deviceID that should be a table. We could try it and see what happens. Maybe a log message that says that the rule is expanded.

    Anyway, I'm on a business trip until Thursday so my coding time is limited for now. Will come back one this.

    Posted

    OK, thanks

    Posted

    also testing publish/subscribe but cannot get it to work. This is my test setup

    Publishing scene

    declared devices in header

    Please login or register to see this code.

    Subscribing scene

    Please login or register to see this code.

    So if i understand it right when something happens with any of the device in publishing scene, subscribe scene should write some debug?

  • Topic Author
  • Posted

    Yes but if you publish a deviceID that is a list you will receive a deviceID that is a list.

    you try to match it with single deviceIDs. See discussion in previous post. 

    Either you loop and do 3 publish, one for each deviceID - or you receive a list of deviceIDs and reposts the individual deviceIDs locally.

    Posted (edited)

    Ah, a good start is to write right logic in publish.... :oops:

     

    Edited by jompa68
    Posted (edited)

    is this correct?

    Please login or register to see this code.

    should log all on/off?

     

    published this

    Please login or register to see this code.

    Correct!

    Please login or register to see this code.

    Still trouble to get all the events from deviceID(784) to subscribed scene.
    I wait for expert answer :-)

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

    is this correct?

    Please login or register to see this code.

    should log all on/off?

     

    published this

    Please login or register to see this code.

    Correct!

    Please login or register to see this code.

    Still trouble to get all the events from deviceID(784) to subscribed scene.
    I wait for expert answer :-)

    Where does the $value come from in the publish statement? Oh, and a publish(event, true) is a static publish but maybe that's what you want?

    In in the match rule, if you match against '$value' you don't have to get the value from the event (the d=env.event...). 'value' is directly available as a variable in the rest of the rule

    Please login or register to see this code.

     

    Posted
    48 minutes ago, jgab said:

    Where does the $value come from in the publish statement?

    Should come from id(784) 

    Damn hard function to get working, perhaps thinking better after my lunch break :huh:

  • Topic Author
  • Posted

    Assume you have a real switch with id 784.

    Please login or register to see this code.

    Whenever the value of 784 changes it will publish that to all other scenes that subscribe to #VirtualSwitch.

    Subscribers would do

    Please login or register to see this code.

    If a subscriber only wanted events for deviceID 784 it would subscribe

    Please login or register to see this code.

    Another example:

    Publisher publish events if room is safe or breached

    Please login or register to see this code.

    We need the 'once' around the second rule as it will trigger whenever any motion sensor is breached. The first rule is only true if all sensors are safe.

    Subscriber takes action if room is all safe or breached.

    Please login or register to see this code.

    The use-case would be a scene that looks after rooms, but don't care about individual sensors.

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