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

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

    strange enough, i got same error on AOQ that works locally only ( no slave hubs). It only manages local devices and it gave same error.

    Yes, it could be happened on local hub also.

     

    That's interesting if anyone else has seen this error as well?

    Edited by cag014
    Link to comment
    Share on other sites

    7 minutes ago, cag014 said:

    Yes, it could be happened on local hub also.

    If it can happen locally, so it is not about lan and its speed.

    What the meaning of bad descr. file? and what http request that happens locally?

    Link to comment
    Share on other sites

    For the following example:
    {0,"1085",{ state="thermostatMode<>@40'hc3l>thermostatMode", trigAct={{"40'hc3l","setThermostatMode,@1085>thermostatMode"}}}},

     

    Does the condition inside "state" has any effect on the "trigact"? I mean before applying the "trigact", does it first check is "state" is true r not ?

    Link to comment
    Share on other sites

    Hi @cag014,

    I had updated AOS to v9.3:

    Please login or register to see this spoiler.

     

    Today I got this e-mail (AOS 7.1 is the name of the (updated to v9.3) AOS scene):

    AOS 7.1 failed at Tue Feb  7 01:01:39 2023 last debug message:

    /opt/fibaro/scenes/442.lua;420: attempt to concatenate global  orF  (a nil value)

     

    In the main code I see orF only in  function getLedStatus().

    Link to comment
    Share on other sites

  • Topic Author
  • 6 hours ago, Rover said:

    Hi @cag014,

    I had updated AOS to v9.3:

    Please login or register to see this spoiler.

    Indeed, very stupid bug

     

    Use attached version

    Please login or register to see this attachment.

     

    BTW this version includes new operators for state and conditions (per user request)

    >=  greater than or equal to

    <=  less than or equal to

    ~= not equal (shown as <> in data table and in console)

    Edited by cag014
    Link to comment
    Share on other sites

  • Topic Author
  • 6 hours ago, Mohamed Refaat said:

    For the following example:
    {0,"1085",{ state="thermostatMode<>@40'hc3l>thermostatMode", trigAct={{"40'hc3l","setThermostatMode,@1085>thermostatMode"}}}},

     

    Does the condition inside "state" has any effect on the "trigact"? I mean before applying the "trigact", does it first check is "state" is true r not ?

    No, 

    trigAct{} trigerred on every change regardless state status (even if the value of the state is the same). You can add condition (as defined in the state) in the command:

    {0,"1085",{trigAct={"40'hc3l","setThermostatMode,@1085>thermostatMode","if {1085:thermostatMode<>@40'hc3l>thermostatMode}"}}},

     

    To trigger true or false on every change you need to define trigAll=true

    For example

    {0,"1085",{ state="thermostatMode<>@40'hc3l>thermostatMode", trigAll=true, trueAct={{"40'hc3l","setThermostatMode,@1085>thermostatMode"}}}},

    Now trueAct{} will be triggered every time when the thermostatMode value reported and the state condition is true.

    You can add falseAct{} and it will be triggered when the state condition is false.

     

    • Like 1
    Link to comment
    Share on other sites

     

    13 hours ago, cag014 said:

    No, 

    trigAct{} trigerred on every change regardless state status (even if the value of the state is the same). You can add condition (as defined in the state) in the command:

    {0,"1085",{trigAct={"40'hc3l","setThermostatMode,@1085>thermostatMode","if {1085:thermostatMode<>@40'hc3l>thermostatMode}"}}},

     

    To trigger true or false on every change you need to define trigAll=true

    For example

    {0,"1085",{ state="thermostatMode<>@40'hc3l>thermostatMode", trigAll=true, trueAct={{"40'hc3l","setThermostatMode,@1085>thermostatMode"}}}},

    Now trueAct{} will be triggered every time when the thermostatMode value reported and the state condition is true.

    You can add falseAct{} and it will be triggered when the state condition is false.

     

     

    Ok, I did that but still have a problem, I will share with you the idea an plz tell me the best way to do it. I am trying to fully syncronize between two thermostats (one of them on master hub and the other one on the slave hub). When I use the method above from both hubs and with the first change on any one of the thermostats, they start to loop the values between each other and enter an infinte loop so as an example:
    Thermostat#1 on master(hc3), Thermostat#2 on slave(hc3l)

    I put the following on master:

    {0,"1",{trigAct={{"2'hc3l","setThermostatMode,@1>thermostatMode","if {1:thermostatMode<>@2'hc3l>thermostatMode}"},{"2'hc3l","setCoolingThermostatSetpoint,@1>coolingThermostatSetpoint","if {1:coolingThermostatSetpoint<>@2'hc3l>coolingThermostatSetpoint}"}}}},

     

    I put the following on slave:

    {0,"2",{trigAct={{"1'hc3","setThermostatMode,@2>thermostatMode","if {2:thermostatMode<>@1'hc3>thermostatMode}"},{"1'hc3","setCoolingThermostatSetpoint,@2>coolingThermostatSetpoint","if {2:coolingThermostatSetpoint<>@1'hc3>coolingThermostatSetpoint}"}}}},

     

    assume initial set point was 24 and once change one of them to 25, they start an infinite loop of exchanging 24 and 25 till i stop the scene. Any explanation for that behaviour and if you have any better ideas plz share. @cag014

    Link to comment
    Share on other sites

    Hi @cag014,

    Using $geoAction I see in the AOQ initiation text:

    Geofence in use for: Users: {615=X,2=Rover} Mobiles: {288=iPhone}

    Name ID Radius Address

    HC3-0000XXXX 219 150 YYYYY 35, Nederland

     

    I think that the ID should be the ID of the mobile, but the mobile ID is 228 and not 219 

     

    BTW: $geoAction works now and then, mostly not.

    Link to comment
    Share on other sites

  • Topic Author
  • On 2/8/2023 at 7:12 PM, Rover said:

    Hi @cag014,

    Using $geoAction I see in the AOQ initiation text:

    Geofence in use for: Users: {615=X,2=Rover} Mobiles: {288=iPhone}

    Name ID Radius Address

    HC3-0000XXXX 219 150 YYYYY 35, Nederland

     

    I think that the ID should be the ID of the mobile, but the mobile ID is 228 and not 219 

     

    BTW: $geoAction works now and then, mostly not.

    The mobile ID is 288 as you can see Mobiles: {288=iPhone}

    The ID of 219 is the ID of the location named HC3-0000XXXX.  You can verify it by:

      http:// [HC3-IP Address]/api/panels/location/219  

     

    or to see all defined locations in the system

     http:// [HC3-IP Address]/api/panels/location

     

    The geofence triggered by the system when receives a new location from the mobile and monitored by AOQ.  If it does not work in mostly cases the issue is not AOQ.

    To verify that you can create a block scene to monitor location and you'll see AOQ and block scene will have same result.

     

    Edited by cag014
    • Thanks 1
    Link to comment
    Share on other sites

  • Topic Author
  • On 2/8/2023 at 8:37 AM, Mohamed Refaat said:

     

     

    Ok, I did that but still have a problem, I will share with you the idea an plz tell me the best way to do it. I am trying to fully syncronize between two thermostats (one of them on master hub and the other one on the slave hub). When I use the method above from both hubs and with the first change on any one of the thermostats, they start to loop the values between each other and enter an infinte loop so as an example:
    Thermostat#1 on master(hc3), Thermostat#2 on slave(hc3l)

    I put the following on master:

    {0,"1",{trigAct={{"2'hc3l","setThermostatMode,@1>thermostatMode","if {1:thermostatMode<>@2'hc3l>thermostatMode}"},{"2'hc3l","setCoolingThermostatSetpoint,@1>coolingThermostatSetpoint","if {1:coolingThermostatSetpoint<>@2'hc3l>coolingThermostatSetpoint}"}}}},

     

    I put the following on slave:

    {0,"2",{trigAct={{"1'hc3","setThermostatMode,@2>thermostatMode","if {2:thermostatMode<>@1'hc3>thermostatMode}"},{"1'hc3","setCoolingThermostatSetpoint,@2>coolingThermostatSetpoint","if {2:coolingThermostatSetpoint<>@1'hc3>coolingThermostatSetpoint}"}}}},

     

    assume initial set point was 24 and once change one of them to 25, they start an infinite loop of exchanging 24 and 25 till i stop the scene. Any explanation for that behaviour and if you have any better ideas plz share. @cag014

    As I understand you run AOQ on master and slave, correct?

    I see you are sending two commands setThermostatMode and setCoolingThermostatSetpoint 

    Since I don't have this device, can you explain the relation between them? I mean when you say changing one of them to 25, what exactly changes, thermostatMode or coolingThermostatSetpoint.

    Since you don't define any property or state, it will be triggered on any change of both properties and any other changes in the device.

    Based on your previous post, your example included setThermostatMode only.

     

    Meanwhile please define property (or state) for trigger and see if it works.

     for example:

    if by changing to 25 and thermostatMode is the property that changes then:

     

    Please login or register to see this code.

     

    if by changing to 25 and coolingThermostatSetpoint is the property that changes then:

     

     

    Please login or register to see this code.

     

     

     

    Edited by cag014
    • Thanks 1
    Link to comment
    Share on other sites

    Is there a way to trigger an action based on date & time?

    example: turnoff a light everday at specific time and another important one for me is to run a scene every friday on specific time @cag014

     

     

    Edited by Mohamed Refaat
    Link to comment
    Share on other sites

  • Topic Author
  • 20 hours ago, Mohamed Refaat said:

    Is there a way to trigger an action based on date & time?

    example: turnoff a light everday at specific time and another important one for me is to run a scene every friday on specific time @cag014

     

     

    Yes. 

    You can use timeSlot 

    For example, here my irrigation procedure

    {10,"`dripper`",{timeSlot="w=1;3;5;7;18:15~",state="true",
                    lineState={"{`weather`:Pressure>1015 and `weather`:WeatherCondition<>rain}"},
                    errAct={{"","tts","$room $name cancelled"},{"`dripper`","turnOff!{`dripper`=false}"}},
                    trueAct={{"$lineId","setTimeSpan","?min(max(floor(@`outTemp`>value)-25,-5)+8,16)?"},
                            {"","tts","$room $name, has started for $timeSpan minutes","{`dripper`=true}`"},
                            {"`dripper`","turnOn!{`dripper`=true}"}},
                    falseAct={"","tts","$room $name, has turned off"},
                    timeoutAct={"`dripper`","turnOff?",""}}}, 
     
    In general, it turns ON the drippers on weekdays (1,3,5,7) at 18:15. Please ignore all weather conditions and other statements.
    You can execute trueAct{} or falseAct{} tables an any month, weekday and time.
     
    Please refer to timeSlot definitions in Advanced Guide...
    Edited by cag014
    • Like 1
    Link to comment
    Share on other sites

    On 2/12/2023 at 12:52 PM, cag014 said:

    Yes. 

    You can use timeSlot 

    For example, here my irrigation procedure

    {10,"`dripper`",{timeSlot="w=1;3;5;7;18:15~",state="true",
                    lineState={"{`weather`:Pressure>1015 and `weather`:WeatherCondition<>rain}"},
                    errAct={{"","tts","$room $name cancelled"},{"`dripper`","turnOff!{`dripper`=false}"}},
                    trueAct={{"$lineId","setTimeSpan","?min(max(floor(@`outTemp`>value)-25,-5)+8,16)?"},
                            {"","tts","$room $name, has started for $timeSpan minutes","{`dripper`=true}`"},
                            {"`dripper`","turnOn!{`dripper`=true}"}},
                    falseAct={"","tts","$room $name, has turned off"},
                    timeoutAct={"`dripper`","turnOff?",""}}}, 
     
    In general, it turns ON the drippers on weekdays (1,3,5,7) at 18:15. Please ignore all weather conditions and other statements.
    You can execute trueAct{} or falseAct{} tables an any month, weekday and time.
     
    Please refer to timeSlot definitions in Advanced Guide...

    Thanks for usual help, I tried the following two scenarios that gave different behaviour, plz clarify:  @cag014
    1. first:

    {0,"1156",{ timeSlot="w=2;5;true02:00",state="true",trueAct={{"_520","startScene",""}}}},

    the AOQ started scene 520 on intializing as if I am using  {0,"1156",{ initAct={{"_520","startScene",""}}}},

    + on days 2 & 5 of the week at 02:00, it started the scene 520 too

    2. Second:

    {0,"1156",{ timeSlot="w=1~7;true03:40",state="true",trueAct={{"_542","startScene",""}}}},
    Strange behaviour here, the AOQ started scene 542 on intializing as if I am using  {0,"1156",{ initAct={{"_542","startScene",""}}}},
    additionally, it did not start the scene on the days 1-7 at 03:40.

    What am I missing here? Its good to say here that I want to run the scenes without any condition regarding device. Just run the scene on specific time.
    Edited by Mohamed Refaat
    Link to comment
    Share on other sites

  • Topic Author
  • @Mohamed Refaat

    During initialization if no initAct{} defined then according to the state the trueAct{} or falseAct{} tables become initAct{}

    To avoid execution of an action table, you can define initOnStartup=false.

    {0,"1156",{ timeSlot="w=2;5;true02:00",state="true",inittOnStartup=false, trueAct={{"_520","startScene",""}}}},
     

    To avoid execution of specific command in the table, you can define condition "{$initMode=false}" 

    {0,"1156",{ timeSlot="w=2;5;true02:00",state="true",trueAct={{"_520","startScene","{$initMode=false}" }}}},
    or to set init field of the command to false
    {0,"1156",{ timeSlot="w=2;5;true02:00",state="true",trueAct={{"_520","startScene", false }}}},
    During initialization,the different between these two options is:
    If "{$initMode=false}" defined you will see the line in the console and the condition status.
    If false defined the line shown with remark "init disabled" w/o any conditions.
     
    Please refer to initOnStartup section in Advanced Guide.
     

    1. Yes, it should be executed on day 2 & 5 at 2am as defined in timeSlot="w=2;5;true02:00"

     

    2. in your second example you're correct, there is a bug... working to fix it.

         Just a question - what the reason for w=1~7 definition? It means every day of week at 03:40, right?

         You can just use "true03:40" definition, it means the same. Execute trueAct{} table every day at 03:40.

     

    To define the jM line without any relation to any device, you can use $blank keyword.

     {"$blank",{ timeSlot="w=2;5;true02:00",trueAct={{"_520","startScene" }}}},

    please note that since no state defined, during initialization it won't be executed.

     

    Will let you know when the bug fixed.

    Edited by cag014
    • Thanks 1
    Link to comment
    Share on other sites

  • Topic Author
  • @Mohamed Refaat

     

    Attached version includes timeSlot range bug fix...

    Please login or register to see this attachment.

     

    Link to comment
    Share on other sites

    for conditions, can numeric operators like "+" and "-" be used??

    another question, can i call an os command from inside AOQ like to reboot??

    Link to comment
    Share on other sites

  • Topic Author
  • 9 hours ago, Mohamed Refaat said:

    for conditions, can numeric operators like "+" and "-" be used??

    another question, can i call an os command from inside AOQ like to reboot??

     

    Please post an example of "+" or "-" usage?

     

    LUA in HC3 does not support many commands like write/read files and no OS command could be executed. 

    If you need to rebboot HC3, it could be done using "reboot" command.

     

    Link to comment
    Share on other sites

    2 hours ago, cag014 said:

     

    Please post an example of "+" or "-" usage?

     

    LUA in HC3 does not support many commands like write/read files and no OS command could be executed. 

    If you need to rebboot HC3, it could be done using "reboot" command.

     

    I will give you one example for "+" and I am sure each one of us can find many useful ways to use it if it is implemented.
    I have a site with  6 controllers. sometimes one controller will lose internet for no specific reason while lan communication will continue working without problems.

    What I did to resolve this, I am sharing internet status between them all, so all of them share their internet status, lets say under these var names internet_status1=0 or 1 .... internet_status6=0 or 1

    on each of them at 4 am, i run the following scene
    if local_internet_status=0 then  -- that means no local internet
                if(internet_status1 + internet_status2+.....internet_status5 >= 2) then    -- that means at least two remote controllers have internet

                               reboot

                end

    end

     

    I dont depend on local internet status alone as the problem maybe from internet service itself or the modem or a switch, so there is no need to reboot the fibaro controller.

     

    I use above scenario accompanied with another one that monitors local communication.

    For os commands, I have a scene that deletes history every 3-4 days, would like to replace that with a  line or two in AOQ. Others may have other thought about using os comands.

    Link to comment
    Share on other sites

  • Topic Author
  • 6 hours ago, Mohamed Refaat said:

    I will give you one example for "+" and I am sure each one of us can find many useful ways to use it if it is implemented.
    I have a site with  6 controllers. sometimes one controller will lose internet for no specific reason while lan communication will continue working without problems.

    What I did to resolve this, I am sharing internet status between them all, so all of them share their internet status, lets say under these var names internet_status1=0 or 1 .... internet_status6=0 or 1

    on each of them at 4 am, i run the following scene
    if local_internet_status=0 then  -- that means no local internet
                if(internet_status1 + internet_status2+.....internet_status5 >= 2) then    -- that means at least two remote controllers have internet

                               reboot

                end

    end

     

    I dont depend on local internet status alone as the problem maybe from internet service itself or the modem or a switch, so there is no need to reboot the fibaro controller.

     

    I use above scenario accompanied with another one that monitors local communication.

    For os commands, I have a scene that deletes history every 3-4 days, would like to replace that with a line or two in AOQ. Others may have other thought about using os comands.

    Yes, you can do any needed calculation inside conditions, but variables must be defined as global or keyword or device properties. Keywords could be defined by user also.

     

    Following your example, assuming internet status1 ... internet_status5 are global variables then:

    "if {$math2<=?&internet_status1 + &internet_status2+.....&internet_status5?}"

    Since at the beginning of conditions you must have a value (not formula), so $math... keyword could be used for "pure" number value.

    $math.. keyword could be any number, in this example $math2 - means value of 2.

    Please refer to AOQ calculator and &math keyword in user guide.

     

    For os commands, I have a scene that deletes history every 3-4 days, would like to replace that with a line or two in AOQ. Others may have other thought about using os comands.

    What exactly you mean by that? What line in AOQ?

    Edited by cag014
    Link to comment
    Share on other sites

    • 2 weeks later...

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