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


All-in-One Scene: How to do it Better


cag014

Recommended Posts

Just now, cag014 said:

To all,

Interesting situation when new scene/device have added.

There are two options: 

1. To display a warning that new scene/device/variable has been detected and to ignore it?

2. To re-initialize AOQ with new items?

 

Any thoughts? 

 

That would be perfect

Additionally, I would suggest to add the following (I already have done it with a small tweak on your precious code):
You cann add an option (lets call it "persistant slave"), where we can choose if @ startup the scene would end in case of slave missing or keep trying till slave comes back online and that to decrease human interference.
In my case, I have already implemented this for AOQ that has 1 slave only with delay of "variable" between trials. Would be perfect to add such option through yourself, and would be more and more perfect if can implement such option in case of more than one slave.
So the AOQ can deal with missing slaves without affecting other slaves and without the need for human interference to restart AOQ.

 

I know the code can deal with such case when it is already actively running. But, I have gone through all possible cases (startup, delays in startup, network issues, even electric power issues that can affect) and still think that such option will be massivly benefecial.

Anyways, Thankyou alot for the wonderful code.

Link to comment
Share on other sites

  • Topic Author
  • 2 hours ago, mjahedobeid said:

     

    That would be perfect
     

    Which option?

    Link to comment
    Share on other sites

    49 minutes ago, cag014 said:

    Which option?

    I thought you would make it as an option, a parameter as per user input. If that is not the case and we have to choose one, I would go with first option. Display warning and continue to work.

    By the way, I find second option is meaning less coz no benefit of reinitializing with considering new items unless you need to add them to be used  and in that case a human interference is required anyways.

     

    • Like 1
    Link to comment
    Share on other sites

    12 minutes ago, Mohamed Refaat said:

    I thought you would make it as an option, a parameter as per user input. If that is not the case and we have to choose one, I would go with first option. Display warning and continue to work.

    By the way, I find second option is meaning less coz no benefit of reinitializing with considering new items unless you need to add them to be used  and in that case a human interference is required anyways.

     

    also support this option..btw, my log shows the following lines today:

    [23.01.2023] [17:04:33] [ERROR] [QUICKAPP98]: QuickApp crashed

    [23.01.2023] [17:04:33] [ERROR] [QUICKAPP98]: main.lua:782: attempt to index a nil value (field '?')

    [23.01.2023] [17:05:04] [ERROR] [QUICKAPP98]: QuickApp crashed

    [23.01.2023] [17:05:04] [ERROR] [QUICKAPP98]: main.lua:2630: attempt to index a nil value (field 'property')

     

    and when adding this line from the docu, it gives me an error msg:

    timeSlot="?$sunriseHour-(60*60)? ~?$sunsetHour+3600? ",

    it gives me:

    (57) Syntax error in timeslot ?$sunriseHour-(60*60)? ~?$sunsetHour+3600?
    e.g. timeSlot="m=5;d=6;21:00~22:00, w=3;06:00~09:00, d!=1, m=3;4"

     

    Link to comment
    Share on other sites

  • Topic Author
  • 52 minutes ago, PSi said:

    timeSlot="?$sunriseHour-(60*60)? ~?$sunsetHour+3600? ",

    it gives me:

    (57) Syntax error in timeslot ?$sunriseHour-(60*60)? ~?$sunsetHour+3600?
    e.g. timeSlot="m=5;d=6;21:00~22:00, w=3;06:00~09:00, d!=1, m=3;4"

    Please do not use whitespace inside definitions:

    ?$sunriseHour-(60*60)? ~?$sunsetHour+3600?

    try that:

    ?$sunriseHour-(60*60)?~?$sunsetHour+3600?

    Link to comment
    Share on other sites

  • Topic Author
  • 1 hour ago, PSi said:

    [23.01.2023] [17:04:33] [ERROR] [QUICKAPP98]: QuickApp crashed

    [23.01.2023] [17:04:33] [ERROR] [QUICKAPP98]: main.lua:782: attempt to index a nil value (field '?')

    [23.01.2023] [17:05:04] [ERROR] [QUICKAPP98]: QuickApp crashed

    [23.01.2023] [17:05:04] [ERROR] [QUICKAPP98]: main.lua:2630: attempt to index a nil value (field 'property')

    Which version? or you did some changes?

    Please post these lines: 782 and 2630

    Link to comment
    Share on other sites

    9 hours ago, cag014 said:

    To all,

    Interesting situation when new scene/device have added.

    There are two options: 

    1. To display a warning that new scene/device/variable has been detected and to ignore it?

    2. To re-initialize AOQ with new items?

     

    Any thoughts? 

     

    If used scenes, devices or variables has been removed, I should like to have AOQ re-initialized with indication of removal.

    Why bothering about new scene/device/variable if not used in AOQ?

    Edited by Rover
    • Like 2
    Link to comment
    Share on other sites

    3 hours ago, Rover said:

     

    If used scenes, devices or variables has been removed, I should like to have AOQ re-initialized with indication of removal.

    Why bothering about new scene/device/variable if not used in AOQ?

     

    Very good idea, however I think that best practice is to minimize reinitializing, or scene aborting. Avoid it by all means if possible. Just keep running unless there is no other way but to stop.

     

    Why would the AOQ stop servicing all other devices because a device is removed by mistake. Just display a warning and keep running 

     

     

    Link to comment
    Share on other sites

    3 hours ago, Mohamed Refaat said:

    Why would the AOQ stop servicing all other devices because a device is removed by mistake. Just display a warning and keep running

    At second thought I agree.  A removed device is a kind of dead device.

    Link to comment
    Share on other sites

    10 hours ago, cag014 said:

    Which version? or you did some changes?

    Please post these lines: 782 and 2630

    hi, no changes from my side, plain v15.6

    L782: 

    gData.ifStart="jM{"..jD[inId].lineNum.."}<font color=grey><small><sub>"..aType.."</sub></small></font> "..("&nbsp"):rep(jmNum-tostring(jD[inId].lineNum):len())..dColor[jD[inId].idType]..findNameRoom(inId,5).."</font>["..sColor[jD[inId].status+1]..jD[inId][jD[inId].property].value.."</font>] ➯ "

     

    L2630:

         if jD[tblId].property:find(property) then 

    Link to comment
    Share on other sites

  • Topic Author
  • All,

    Attached version deals with the new added /devices/scenes and etc... including warning messages 

    Please login or register to see this spoiler.

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

  • Topic Author
  • 9 hours ago, PSi said:

    hi, no changes from my side, plain v15.6

    L782: 

    gData.ifStart="jM{"..jD[inId].lineNum.."}<font color=grey><small><sub>"..aType.."</sub></small></font> "..("&nbsp"):rep(jmNum-tostring(jD[inId].lineNum):len())..dColor[jD[inId].idType]..findNameRoom(inId,5).."</font>["..sColor[jD[inId].status+1]..jD[inId][jD[inId].property].value.."</font>] ➯ "

     

    L2630:

         if jD[tblId].property:find(property) then 

    Strange...

    PLease let me know if it hapens with 15.8 version also

    Link to comment
    Share on other sites

    1 hour ago, cag014 said:

    All,

    Attached version deals with the new added /devices/scenes and etc... including warning messages 

    Please login or register to see this spoiler.


    What about a removed device? how the scene deal with it?
    Any update regarding missing slave controller @ startup?

    Link to comment
    Share on other sites

    By the way, As I am using V15.7 (under test), a while ago I received this error
    [24.01.2023] [18:37:24] [ERROR] [AOQ38]: jM{-}D  Default Room:384'hc3:99.0[dead] ➯ parent and children are disconnected.
    [24.01.2023] [18:40:03] [TRACE] [AOQ38]: jM{+}W  Default Room:384'hc3:99.0[awake] ➯ parent and children are connected.

     

    As I understand, this means device 384 on the slave controller "hc3" was disconnected and reconnected. For the surprise, this device is not used at all at the AOQ, not even checking its status.  Any information why such thing happens ??

    Link to comment
    Share on other sites

  • Topic Author
  • 1 hour ago, mjahedobeid said:

    By the way, As I am using V15.7 (under test), a while ago I received this error
    [24.01.2023] [18:37:24] [ERROR] [AOQ38]: jM{-}D  Default Room:384'hc3:99.0[dead] ➯ parent and children are disconnected.
    [24.01.2023] [18:40:03] [TRACE] [AOQ38]: jM{+}W  Default Room:384'hc3:99.0[awake] ➯ parent and children are connected.

     

    As I understand, this means device 384 on the slave controller "hc3" was disconnected and reconnected. For the surprise, this device is not used at all at the AOQ, not even checking its status.  Any information why such thing happens ??

    Yes,

    AOQ receives everything that happens on any controller, so, yes in your case device 384 (in hc3), has been dead and controller woke him up.

     

    Again, it's just a warning message to make sure that user is aware about the problem.

     

    Link to comment
    Share on other sites

    21 minutes ago, cag014 said:

    AOQ receives everything that happens on any controller

     

    Isnt it better to preserve processing and only monitor/collect info about used devices in the scene??

     

    Why bother about unused devices wether locally on same controller or remotly on slave one. I am afraid of wasting processing power more than required. Maybe that explains why AOQ consumes processor in some cases.

    Link to comment
    Share on other sites

  • Topic Author
  • 11 minutes ago, Mohamed Refaat said:

     

    Isnt it better to preserve processing and only monitor/collect info about used devices in the scene??

     

    Why bother about unused devices wether locally on same controller or remotely on slave one. I am afraid of wasting processing power more than required. Maybe that explains why AOQ consumes processor in some cases.

    That's exactly what happens, during the monitoring this info received and just displayed to user. In some cases, it helps users to fix communication problems that they even don't know about it and wondering why the controller is not responsive. Just FYI when the controller sends dead message, it means the controller have sent at least three times the command and in case you have few dead devices it actually slows down the controller performances.  At least when user knows that he has a problem with some device he can exclude the device from global polling (recommended)

    Edited by cag014
    Link to comment
    Share on other sites

    Well, I always thought that handling dead devices is done automatically by the controller they are connected to. So, in case of dead device, its controller will try to wake it for few times before disabling it to not affect the whole performance.

     

    So, my question is still there. Why load your scene with non required functions such as monitoring every thing every where. Best practice is to focus on devices used/required and let the system deal in ordinary way with rest.

     

    The warning will be ok in case monitoring everything doesnt make AOQ consume more processing. But in case it affects, I would focus on required devices only rather than all devices.

    Link to comment
    Share on other sites

  • Topic Author
  • 16 minutes ago, Mohamed Refaat said:

    Well, I always thought that handling dead devices is done automatically by the controller they are connected to. So, in case of dead device, its controller will try to wake it for few times before disabling it to not affect the whole performance.

     

    So, my question is still there. Why load your scene with non required functions such as monitoring every thing every where. Best practice is to focus on devices used/required and let the system deal in ordinary way with rest.

     

    The warning will be ok in case monitoring everything doesnt make AOQ consume more processing. But in case it affects, I would focus on required devices only rather than all devices.

    By the way, if you are concerning about process consumption you might be interesting using

    Please login or register to see this link.

    . Same as AOQ but runs on PC (using ZeroBrane Studio or VS code).

    The biggest advantage using AOR that you can use full power of LUA (like creating files and storing data for analyze, HTTP , execute external programs according to devices/scene states and more..)

     

    I'm about to release new AOR with all AOQ latest updates. 

    • Like 1
    Link to comment
    Share on other sites

  • Topic Author
  • 2 hours ago, mjahedobeid said:

    Any update regarding missing slave controller @ startup?

    What you suggest doing with "broken" slave devices/scenes/vraiables?

    I mean if I have actions that that executed according to this slave sensors or to turnOn/Off devices on this slave? 

    And even so, when the slave back online, AOQ need to be reinitialized to read salve's configuration and check the jM lines? 

     

    It might be an idea to have an option to load different jM configurations if any slave is down.

     

    Edited by cag014
    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...