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

8 minutes ago, jgab said:

Ok, it turned out that it was an interesting issue...

id:value=true does not translate to a property update for a binary switch, but to a :turnOn 

which calls your QAs QuickApp:turnOn function that only sets the state...

 

To get around that, we need to set the properties directly, do

Please login or register to see this code.

 

Okay, but what is the setValue function. Is it somewhere in ER4 framework?

And where do i use the setProp function?

Edited by Neo Andersson
Link to comment
Share on other sites

49 minutes ago, jgab said:

Ok, it turned out that it was an interesting issue...

id:value=true does not translate to a property update for a binary switch, but to a :turnOn 

which calls your QAs QuickApp:turnOn function that only sets the state...

 

To get around that, we need to set the properties directly, do

Please login or register to see this code.

 

Jan, i have tried this, and still doesnt work. First it doesnt recognize setValue function, so i thought you probably meant to use setProp function. I have changed it to setProp, but still no effect, the testGate never changes according to the sensor.

 

I have tried every rule one by one. None of them works

Edited by Neo Andersson
Link to comment
Share on other sites

  • Topic Author
  • 15 minutes ago, Neo Andersson said:

    Jan, i have tried this, and still doesnt work. First it doesnt recognize setValue function, so i thought you probably meant to use setProp function. I have changed it to setProp, but still no effect, the testGate never changes according to the sensor.

     

    I have tried every rule one by one. None of them works

    Yes, setProp - changed the name when I pasted it into the forum.

    Well, it does work for me - I'm off for a dinner now but will have a look tomorrow morning - and post the test I did.

    Link to comment
    Share on other sites

    15 minutes ago, jgab said:

    Yes, setProp - changed the name when I pasted it into the forum.

    Well, it does work for me - I'm off for a dinner now but will have a look tomorrow morning - and post the test I did.

    Okay, i have found source of first problem. You have incorrectly formed the setProp function. There is missing an argument "prop". So the sensor part works.

    Please login or register to see this code.

     

    However, the first rule works only once..

     

    Please login or register to see this code.

     

    The test goes like this.

    The testGate, the testGateSensor and the testGateRelay all are in false state. (the testGate status proerty is set to false manually at the beggining.)

    When now i press the testGate button, it nicely turns on the testRelay and testGate's icon doesnt change (as it supposed to be)

    When the gatSensor gets breached, the testGate icon nicely chages to GREEN. Now we close the gate, so the sensor goes to safe, and the testGate icon nicely truns back to red, as it should.

    However, when now i try to repeat the cycle, the testRelay doesnt open. So the very first rule is not performed. It seems to me, that the testGate state proeprty doesnt get back to false with the line setProp(testGate,'state',false)

    Now when i manually set the state back to false , and retry the cyclus it works again.

     

    Okay, see you tomorrow

    Edited by Neo Andersson
    Link to comment
    Share on other sites

    40 minutes ago, Neo Andersson said:

    Okay, i have found source of first problem. You have incorrectly formed the setProp function. There is missing an argument "prop". So the sensor part works.

    Please login or register to see this code.

     

    However, the first rule works only once..

     

    Please login or register to see this code.

     

    The test goes like this.

    The testGate, the testGateSensor and the testGateRelay all are in false state. (the testGate status proerty is set to false manually at the beggining.)

    When now i press the testGate button, it nicely turns on the testRelay and testGate's icon doesnt change (as it supposed to be)

    When the gatSensor gets breached, the testGate icon nicely chages to GREEN. Now we close the gate, so the sensor goes to safe, and the testGate icon nicely truns back to red, as it should.

    However, when now i try to repeat the cycle, the testRelay doesnt open. So the very first rule is not performed. It seems to me, that the testGate state proeprty doesnt get back to false with the line setProp(testGate,'state',false)

    Now when i manually set the state back to false , and retry the cyclus it works again.

     

    Okay, see you tomorrow

    Just to give you results of my tests:

    It turned out that the state property can not be updated by the setProp function. The value property can, but the state property can not.

    So when I use

     

    Please login or register to see this code.

    This works, (as we are updating state property inside turnOn and turnOff functions of testGate), so calliing directly turnOff function will update state property. I dont know why, this is a question for you. the api call in setProp function doesnt work for the state property i think.
    Link to comment
    Share on other sites

    9 minutes ago, Neo Andersson said:

    Just to give you results of my tests:

    It turned out that the state property can not be updated by the setProp function. The value property can, but the state property can not.

    So when I use

     

    Please login or register to see this code.

    This works, (as we are updating state property inside turnOn and turnOff functions of testGate), so calliing directly turnOff function will update state property. I dont know why, this is a question for you. the api call in setProp function doesnt work for the state property i think.

    Okay one more update

    Actually the setProp function updates state property. I have checked it in swagger. However

    Please login or register to see this code.

    doesn't trigger when I click on the device icon. It doesn't react. It works only once. This is beyond my understanding.

    Link to comment
    Share on other sites

  • Topic Author
  • Ok, this works for me.

    I have a testGate QA (id 1246) that looks like

    Please login or register to see this code.

     

    Then I also have a testSensor QA (id 1247) It has methods for turnOn and turnOff so I can simulate the sensor being breached/safe.

    Please login or register to see this code.

     

    Then my rules looks like

    Please login or register to see this code.

    So here we wait 5s before "breaching" the sensor to simulate the delay from when the relay starts and the sensor detects - and we then "breached" the sensor by calling turnOn in the rule. With a real sensor this should be removed in the first and second rule.

     

    In the last rule we shouldn't need to set 'state' to false as it is already done  by the QA itself (however, it isn't a problem if we do)

     

    Anyway, for me, I can turn on and turn off the testGate by clicking on the device icon, it turns red and green and I can repeat it multiple times.

    Link to comment
    Share on other sites

    10 hours ago, jgab said:

    Ok, this works for me.

    I have a testGate QA (id 1246) that looks like

    Please login or register to see this code.

     

    Then I also have a testSensor QA (id 1247) It has methods for turnOn and turnOff so I can simulate the sensor being breached/safe.

    Please login or register to see this code.

     

    Then my rules looks like

    Please login or register to see this code.

    So here we wait 5s before "breaching" the sensor to simulate the delay from when the relay starts and the sensor detects - and we then "breached" the sensor by calling turnOn in the rule. With a real sensor this should be removed in the first and second rule.

     

    In the last rule we shouldn't need to set 'state' to false as it is already done  by the QA itself (however, it isn't a problem if we do)

     

    Anyway, for me, I can turn on and turn off the testGate by clicking on the device icon, it turns red and green and I can repeat it multiple times.

    @jgab

    Jan, kill me but this does not work.

     

    Here is my gate QA

     

    Please login or register to see this code.

     

    The relay is a simple binary switch

     

    Please login or register to see this code.

     

    And this is a simple binary sensor QA for thestin, with two buttons simulating state changes

    Please login or register to see this code.

     

    And these are the rules

     

    Please login or register to see this code.

     

     

    Plesase do the same procedure with me in your system

     

    Set everythinbg to false, closed, truend off etc

     

    1. Press testGate icon / testRelay turns on - this is okay

    2. Then simulate sensor to TRUE - / sensor icon changes and also testGate icon changes - this is okay

    3. Now simulate sensor to FALSE - / sensor icon changes to red, and testGate icon changes to red - this is okay

    4. Press again testGate icon - nothing happens - in the rule the "rule("testGate:state == true => testGateRelay:on")" part never teriggers again. Only when a reload, restart the testGate QA., then it starts working again.

     

     

     

    As i wrote you in previous post, using this formula 

    Please login or register to see this code.

    makes it work.

     

    I need to know the reason behind this, why is this happening, or fif i just missed something (as i used to :-)), becuase i will use this solution (if it works ) in many installations.

     

    Thanks a lot

     

    UPDATE:

    Jan just try these two rules. Without any sensor involvement.

    Doesn't work. It turnes on the relay, but the next click on the testGate does not turn off the relay.

     

    Actually it seems, that turnOff function in testGate never runs, if the value property is FALSE and vice versa. So the turnOff function is not called by the second ruie, becuase testGate value is false. I don't know if there is any workaround.

     

    Please login or register to see this code.

    Edited by Neo Andersson
    Link to comment
    Share on other sites

  • Topic Author
  • 11 hours ago, Neo Andersson said:

    @jgab

    Jan, kill me but this does not work.

     

    Here is my gate QA

     

    Please login or register to see this code.

     

    The relay is a simple binary switch

     

    Please login or register to see this code.

     

    And this is a simple binary sensor QA for thestin, with two buttons simulating state changes

    Please login or register to see this code.

     

    And these are the rules

     

    Please login or register to see this code.

     

     

    Plesase do the same procedure with me in your system

     

    Set everythinbg to false, closed, truend off etc

     

    1. Press testGate icon / testRelay turns on - this is okay

    2. Then simulate sensor to TRUE - / sensor icon changes and also testGate icon changes - this is okay

    3. Now simulate sensor to FALSE - / sensor icon changes to red, and testGate icon changes to red - this is okay

    4. Press again testGate icon - nothing happens - in the rule the "rule("testGate:state == true => testGateRelay:on")" part never teriggers again. Only when a reload, restart the testGate QA., then it starts working again.

     

    This works for me. Step 4 trigger the rule and the relay is set to on. Then I have to do a step 5. Simulate sensor to TRUE, for the button to turn green etc etc.

    Btw, in your example I'm missing  the rule that closes the relay..

    Please login or register to see this code.

    otherwise the relay will not trigger again in the example

     

    11 hours ago, Neo Andersson said:

     

     

    As i wrote you in previous post, using this formula 

    Please login or register to see this code.

    makes it work.

    The only thing hub.call(testGate,"turnOff") is to call the QUickApp:turnOff() method that sets the state to false, the same as setProp(testGate,"state",false)

    However that should not be necessary as the only reason the testGateSensor turns safe and trigger the rule is because the testGate QA has set it's state to false to start the relay...

     

    11 hours ago, Neo Andersson said:

    UPDATE:

    Jan just try these two rules. Without any sensor involvement.

    Doesn't work. It turnes on the relay, but the next click on the testGate does not turn off the relay.

     

    Actually it seems, that turnOff function in testGate never runs, if the value property is FALSE and vice versa. So the turnOff function is not called by the second ruie, becuase testGate value is false. I don't know if there is any workaround.

     

    Please login or register to see this code.

    This will not work as you have nothing setting the value of the testGate, and it's the :value of the testGate that decides the color of the icon and if the turnOn/turnOff should be called.

     

     

    11 hours ago, Neo Andersson said:

    I need to know the reason behind this, why is this happening, or fif i just missed something (as i used to :-)), becuase i will use this solution (if it works ) in many installations.

     

    Thanks a lot

     

     

    Link to comment
    Share on other sites

  • Topic Author
  • works like a charm with the Yubii app too

    These are my rules

    Please login or register to see this code.

     

    Here is a screen video of the yubii app. I flip the gateSensor in the web UI a few seconds after I have switched the gateQA in the Yubii app.

    Please login or register to see this link.

    Repeatable ad infinitum...

    Edited by jgab
    Link to comment
    Share on other sites

    12 hours ago, jgab said:

    works like a charm with the Yubii app too

    These are my rules

    Please login or register to see this code.

     

    Here is a screen video of the yubii app. I flip the gateSensor in the web UI a few seconds after I have switched the gateQA in the Yubii app.

    Please login or register to see this link.

    Repeatable ad infinitum...

     

    @jgab Okay 

     

    Seems that the problem is coming in situations, when we try to set the sensor back to false, without the testGate turnOff called.

    What does that mean ? If user opens the gate by pressing the testGate icon, the gate opens, sensor changes to TRUE, and testGate icon color changes to GREEN.

    However, when someone closes the gate using other source,  (original remote controller), the gate closes, the sensor jumps back to false, the icon changes back to red, but next time user will not be able to open the gate uing testGate..

     

    I think that was the problem. I have spent like a day with this...:-)

     

    And also, 99 percent of my installations, gates do not have open/close buttons. They use just a signal that toggles the procedure. So in our QA, turnoff function actually turnsOn the realy that runs(closes) the gate again. (relay has an auto off function applied to allow turnOn functioin calling repeatedly)

     

    Edited by Neo Andersson
    Link to comment
    Share on other sites

  • Topic Author
  • 15 minutes ago, Neo Andersson said:

     

    @jgab Okay 

     

    Seems that the problem is coming in situations, when we try to set the sensor back to false, without the testGate turnOff called.

    What does that mean ? If user opens the gate by pressing the testGate icon, the gate opens, sensor changes to TRUE, and testGate icon color changes to true.

    However, when someone closes tha gate using other source,  (original remote controller), the gate closes, the sensor jumps back to false, the icon changes back to red, but next time user will not be able to open the gate uing testGate..

    This rule ensures that the value of testGate is set to false when sensor is safe

    Please login or register to see this code.

    Add setProp to set the state to false too, to make sure we can trigger the 

    Please login or register to see this code.

    again.

    Edited by jgab
    • Like 1
    Link to comment
    Share on other sites

    1 hour ago, jgab said:

    This rule ensures that the value of testGate is set to false when sensor is safe

    Please login or register to see this code.

    Add setProp to set the state to false too, to make sure we can trigger the 

    Please login or register to see this code.

    again.

     

    Jan, i think this is the teritory, that i have to give up, and stick to the old solutions.

    There is another situation, when someone opens the gate from other source. So the sensor got breached, and it sets the testGate value to true, what makes the relay to turn ON. That means user will experience a strange behaviour. He opens the gate by a remote controller, and the gate starts to move then stops / or tries to move back and close depending on the gate mechanism.

    So testSensor:breached causes the testRelay:on

    Testing it is ease. Just set everything to false, then set sensor to breached state. Itt will set testGate icon to green and that will run the relay, so eventually stops the gate. The rule 3 triggers rule 1 so the gate eventually stops.

     

    Thank you soo much for all your time and efforts.

     

    I am using this setup.

    Please login or register to see this code.

    Link to comment
    Share on other sites

    Jan problem lights will not switch off. How to kill the post(#knipperenAan)?

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

  • Topic Author
  • 54 minutes ago, Sjakie said:

    Jan problem lights will not switch off. How to kill the post(#knipperenAan)?

     

    Please login or register to see this code.

     

    Who/what posts #licht_Kerst_Uit to end the loop ?

    Link to comment
    Share on other sites

    Rule.eval([[#licht_Kerst_Uit =>
            for _,id in pairs(kerstVersiering) do id:off; wait(00:00:02end;
                log('#C:yellow#Kerstverlichting binnen - Uit')
    ]])

    Please login or register to see this code.

     

    I have 6 wall plugs who and the impact on HC3 is much too much!
    It create a CPU usage continuous of around 50% and slowing down switch HUE on with a few seconds.
    I will change time on/off
    Thanks
    Edited by Sjakie
    added the requested info
    Link to comment
    Share on other sites

    Hello Jan. And again I have a problem with a NEW ER4 installation...I've been using ER4 for heating control on all my HC3s for a long time, namely the task:
    1) if ALL rooms are heated according to the temperatures specified in the climate panel, then turn off the BOILER
    2) if ANY room needs heating, then turn on the boiler
    3) it has been working for a long time and perfectly, somewhere long ago we learned to extract the set temperatures from the climate panel through the API...
    it looks like this..

     Util.defTriggerVar("cliZone_vitalnya",0)  
      rule("@@-00:01 => cliZone_vitalnya = api.get('/panels/climate/1').properties.currentTemperatureHeating;log('Кл.панель вітальня %s ' ,cliZone_vitalnya)").start()
      --  
      Util.defTriggerVar("cliZone_kitch",0)  
      rule("@@-00:01 => cliZone_kitch = api.get('/panels/climate/2').properties.currentTemperatureheating;log('Кл.панель кухня %s ' ,cliZone_kitch)").start() 
      --
      Util.defTriggerVar("cliZone_TP_kor",0)  
      rule("@@-00:01 => cliZone_TP_kor = api.get('/panels/climate/3').properties.currentTemperatureheating;log('Кл.панель коридор %s ' ,cliZone_TP_kor)").start()
     

    4) and then we work with ready-made numbers...so in my NEW ER4 installation, these rules DO NOT WORK! More precisely, somehow with a glitch... ONLY the 1st temperature is extracted, and then an error!

     What am I doing wrong?

    Please login or register to see this attachment.

     

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

  • Topic Author
  • 3 hours ago, fastvd said:

    big "H" = problem

    Yes ;-) 

    Link to comment
    Share on other sites

    On 2/3/2023 at 3:17 PM, jgab said:

    Sorry, my fault. Try this one

    Please login or register to see this code.

     

    Hello. on the basis of this rule, how can we simply overload our same controller on which ER4 is hanging? how to describe a simple POST on reboot?

    something like this doesn't work)
    rule ("496:isOn => http.post(fmt('http://192.168.0.254/api/service/reboot'))")

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