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

@jgabI want to creat a quickapp with more child devices looks like Single-point switch,Is there a portable way?Thank you!

Edited by lux
Link to comment
Share on other sites

  • Topic Author
  • 16 hours ago, lux said:

    @jgabI want to creat a quickapp with more child devices looks like Single-point switch,Is there a portable way?Thank you!

    Eh, I think I need more info - can you describe in more details what you have in mind?

    If you wan't to create one QA that controls other (child) QAs, you should as in

    Please login or register to see this link.

     

    If it's to control child devices from ER, this is the place - but I need more info. 

    Link to comment
    Share on other sites

  • Topic Author
  • I pushed v0.994 with support for creating children.

    Ex.

    Please login or register to see this code.

     

    You define children with child(<uid>,<name>,<type>), if child already exists this does nothing.

    after all children are defined you call initChildren()

    This will create variables of the uids bound to the device ids

    It will also create a variable <uid>_D that is the child device object.

     

    When buttons are called on the child device it will generate #UI events, that you map to what should happen. In this case we update the value prop using the child object to true/false which is expected from a binarySwitch.

     

    When the child changes value prop we of course get an  :isOn trigger we can act on.

     

    If you remove the rule defining the child (ID1 in this case), the child device is removed too when ER is restarted.

     

    This makes it easy to create extra "GUI" devices for ER.

     

    Soon I will come with an update to improve the usage of child devices in ER (already realised that interfaces were missing)

    • Like 1
    Link to comment
    Share on other sites

    6 minutes ago, jgab said:

    I pushed v0.994 with support for creating children.

    Ex.

    Please login or register to see this code.

     

    You define children with child(<uid>,<name>,<type>), if child already exists this does nothing.

    after all children are defined you call initChildren()

    This will create variables of the uids bound to the device ids

    It will also create a variable <uid>_D that is the child device object.

     

    When buttons are called on the child device it will generate #UI events, that you map to what should happen. In this case we update the value prop using the child object to true/false which is expected from a binarySwitch.

     

    When the child changes value prop we of course get an  :isOn trigger we can act on.

     

    If you remove the rule defining the child (ID1 in this case), the child device is removed too when ER is restarted.

     

    This makes it easy to create extra "GUI" devices for ER.

     

    Soon I will come with an update to improve the usage of child devices in ER (already realised that interfaces were missing)

    Interesting idea. could you share the examples of use cases?

     

    Link to comment
    Share on other sites

  • Topic Author
  • 3 hours ago, petrkl12 said:

    Interesting idea. could you share the examples of use cases?

     

    If you need an on/off switch to control some rules it's easy to define a binarySwitch QA to be the GUI.

    Now this is just for predefined QA types but I could add the possibility to create a custom UI I guess...

    • Thanks 1
    Link to comment
    Share on other sites

    @jgabthank you! This is a better idea. I am considering building another quickapp and children use eventrun rules but not build in eventrun. Can it be realized?

    Please login or register to see this code.

    Another question is whether this function can be integrated, or there is a better way. This is to get a single ID, or perhaps an array ID

    Please login or register to see this code.

    Ext: It looks too long
    room804_lamps = {getID('floorname1','roomame','devicename'),getID('floorname2','roomame','devicename')}

    Edited by lux
    Link to comment
    Share on other sites

    On 1/7/2023 at 10:05 AM, jgab said:

    So, this I think is better. It handles custom report times better.

    rule("@21:00 => post(#timeReport{reset=true})") will log a report at 21:00 and reset the sum counters.

    rule("@21:00 => post(#timeReport{reset=false})") will report without resetting the counters.

     

    You could do a 

    rule("497:off => post(#timeReport{reset=false})") to trigger a report every time you turn off the light  and see if it sums correctly.

     

    To do it for power usage you need to have the power usage x time, so if you have the time? I believe that @fastvd has experimented with power consumptions...

     

    Please login or register to see this code.

     

    This rule only differs between on and off. I have a Shelly plug that records TV consumption 24/7. About 5W in stand-by.

    Is it possible to record the time when the Shelly plug consumption is > 75 W?

    rule("#timeDevices:power>75 => lastOn[env.event.id]=now") doesn´t work

     

    Do you have an example for me?

    Link to comment
    Share on other sites

  • Topic Author
  • On 2/21/2023 at 3:09 PM, lux said:

    @jgabthank you! This is a better idea. I am considering building another quickapp and children use eventrun rules but not build in eventrun. Can it be realized?

    Please login or register to see this code.

    Another question is whether this function can be integrated, or there is a better way. This is to get a single ID, or perhaps an array ID

    Please login or register to see this code.

    Ext: It looks too long
    room804_lamps = {getID('floorname1','roomame','devicename'),getID('floorname2','roomame','devicename')}

    It's questionable if it's worthwhile to create the map tables - because you create new ones for every call. Only if you create the tables once outside the function so they are reused. Like this

    Please login or register to see this code.

    However, if you move around devices you need to recreate the map.

     

    If you don't call it millions of times I would do it simpler and skip the map tables

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

  • Topic Author
  • On 2/24/2023 at 10:15 AM, KaWi said:

    This rule only differs between on and off. I have a Shelly plug that records TV consumption 24/7. About 5W in stand-by.

    Is it possible to record the time when the Shelly plug consumption is > 75 W?

    rule("#timeDevices:power>75 => lastOn[env.event.id]=now") doesn´t work

     

    Do you have an example for me?

    It's a bit more complex as power is reported every time it changes - not only when it changes > 75.

    I think this could be the way - it still works with several power plus. If it's only one device the code can be much simpler

    Please login or register to see this code.

     

    Edited by jgab
    Link to comment
    Share on other sites

    @jgabDo I need to add this to eventrun.lua or main.lua
     

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

  • Topic Author
  • 10 minutes ago, lux said:

    @jgabDo I need to add this to eventrun.lua or main.lua
     

    Please login or register to see this code.

     

    In main, add it inside function QuickApp:main(), somewhere before you define the rules

     

    Link to comment
    Share on other sites

    @jgabI will try this ,thank you , a question is : if i user quick app add Relay switch , the device not recognized in  homeassistant , but i add device switch , it will recognized,Is there any way to solve this problem , Thank you!

     

    I use this generation the device:

     

    Please login or register to see this code.

     

    Edited by lux
    Link to comment
    Share on other sites

    @jgab

    Please login or register to see this code.

    it can't work ! need help ! thank you

     

    Please login or register to see this code.

     

    Edited by lux
    Link to comment
    Share on other sites

  • Topic Author
  • 6 minutes ago, lux said:

    @jgab

    Please login or register to see this code.

    it can't work ! need help ! thank you

     

    Please login or register to see this code.

     

    Sorry, it should be

    Please login or register to see this code.

    and it returns a table of devices so just

    lamps = getID(...) 

    34 minutes ago, lux said:

    @jgabI will try this ,thank you , a question is : if i user quick app add Relay switch , the device not recognized in  homeassistant , but i add device switch , it will recognized,Is there any way to solve this problem , Thank you!

     

    I use this generation the device:

     

    Please login or register to see this code.

     

     

    You mean a com.fibaro.multilevelSwitch ?

    If it's not recognised by homeassistant it's not so much that can be done on the HC3 side because you need to communicate the selected value somehow.

    Link to comment
    Share on other sites

    @jgabthank you very much ! i try again! now it like this!

    Please login or register to see this code.


     

    Edited by lux
    Link to comment
    Share on other sites

    On 2/25/2023 at 10:03 AM, jgab said:

    It's a bit more complex as power is reported every time it changes - not only when it changes > 75.

    I think this could be the way - it still works with several power plus. If it's only one device the code can be much simpler

    Please login or register to see this code.

     

    Hi @jgab

    It doesn´t work. It gives me an error

     

    [26.02.2023] [10:38:27] [DEBUG] [QUICKAPP1093]:

    Sunday, February 26, ER uptime:0 hours Sunrise:07:21, Sunset:17:57 #Events handled :1 ,#Events matched:1 #Rules succeeded:0 ,#Rules false:0 #Rules error :0 Memory:1107.8kb [100% 100% 100% 100% 100% 100% 100%]

    [26.02.2023] [10:38:44] [ERROR] [QUICKAPP1093]: in Rule:4[timeDevices:power & powerLimit(env.event.id) > PLIMIT => lastOn[env.event.id]=n...]: ./include/EventRunner.lua:1802: ./include/main.lua:220: attempt to compare number with boolean

    [26.02.2023] [10:38:45] [ERROR] [QUICKAPP1093]: in Rule:5[timeDevices:power & powerLimit(env.event.id) <= PLIMIT => sumOn[env.event.id]= s...]: ./include/EventRunner.lua:1802: ./include/main.lua:220: attempt to compare number with boolean

     

    What can i do?

     

     

     

    Link to comment
    Share on other sites

  • Topic Author
  • On 2/26/2023 at 10:46 AM, KaWi said:

    Hi @jgab

    It doesn´t work. It gives me an error

     

    [26.02.2023] [10:38:27] [DEBUG] [QUICKAPP1093]:

    Sunday, February 26, ER uptime:0 hours Sunrise:07:21, Sunset:17:57 #Events handled :1 ,#Events matched:1 #Rules succeeded:0 ,#Rules false:0 #Rules error :0 Memory:1107.8kb [100% 100% 100% 100% 100% 100% 100%]

    [26.02.2023] [10:38:44] [ERROR] [QUICKAPP1093]: in Rule:4[timeDevices:power & powerLimit(env.event.id) > PLIMIT => lastOn[env.event.id]=n...]: ./include/EventRunner.lua:1802: ./include/main.lua:220: attempt to compare number with boolean

    [26.02.2023] [10:38:45] [ERROR] [QUICKAPP1093]: in Rule:5[timeDevices:power & powerLimit(env.event.id) <= PLIMIT => sumOn[env.event.id]= s...]: ./include/EventRunner.lua:1802: ./include/main.lua:220: attempt to compare number with boolean

    What can i do?

    Sorry, my fingers were too fast. I updated the previous post with a fix.

    Link to comment
    Share on other sites

    On 2/25/2023 at 10:03 AM, jgab said:

    Please login or register to see this code.

    Hi Jan,

    Sorry, but it doesn´t work. I still got the error that attempt to compare number with boolean.

    I just have some time in the office 😉and I have now used the following: 

     

    PLIMIT = 75
      local powers = {}
      function powerLimit(id,dflt) -- return power when power goes over or under PLIMIT, otherwise return false
        dflt = dflt or math.maxinteger
        local pow = fibaro.getValue(id,'power')
        if powers[id] ~= tonumber(pow > PLIMIT) then 
          powers[id]= tonumber(pow > PLIMIT)
          return pow
        else return dflt end
      end

     

    This works perfectly. 

     

    Thanks for your help 👍

    Link to comment
    Share on other sites

    Hi there

     

    I am new to the HC3 and to the forum, so please forgive me if this has been answered elsewhere in this 200+ page topic ;) I have read as much as I could and am not sure of the answer... 

     

    Context: I have two split system ACs in an area of my house that is frequently damp, they are wifi-enabled and report, among other things, indoor humidity via a QuickApp. When the humidity crosses above a threshold, I want to get a notification on my phone. However, I want to rate limit the notifications so they are not just continuously flooding my phone every time the sensor is polled (which another QuickApp, for Daikin integration, does every so often, I don't know the exact frequency but it's fairly frequent). 

     

    I have this rule (x2)
     

    Please login or register to see this code.

     

    (the alerting is different to the examples here but I couldn't get the phone:msg syntax working, so I copied that from a LUA scene)

     

    This is fine except when the humidity is close to 80%, which causse the sensor reading to cross 80% repeatedly in a short time (80, 75, 80, 75... etc). Is there a way I can get a notification when the sensor crosses 80% the first time, and then only once per x minutes while the humidity remains high?

    I've seen the examples using again() but it doesn't seem to be quite what I want since I don't want the x minute delay on the first notification. I'm not clear if I use wait() at the end of the rule, whether it will block the rule from getting triggered again while it's waiting?

     

    A second question - I have 2 of these ACs (front room and back room). Currently I just have two separate rules but is there a clever way to collapse them into one rule, so that it triggers when either goes above the threshold, but then the timer applies to both after that (the rooms are next to each other, the humidity is obviously correlated). 

     

    Thanks!

     

     

     

    Edited by bonhomme
    Link to comment
    Share on other sites

  • Topic Author
  • On 3/3/2023 at 7:11 AM, bonhomme said:

    Hi there

     

    I am new to the HC3 and to the forum, so please forgive me if this has been answered elsewhere in this 200+ page topic ;) I have read as much as I could and am not sure of the answer... 

     

    Context: I have two split system ACs in an area of my house that is frequently damp, they are wifi-enabled and report, among other things, indoor humidity via a QuickApp. When the humidity crosses above a threshold, I want to get a notification on my phone. However, I want to rate limit the notifications so they are not just continuously flooding my phone every time the sensor is polled (which another QuickApp, for Daikin integration, does every so often, I don't know the exact frequency but it's fairly frequent). 

     

    I have this rule (x2)
     

    Please login or register to see this code.

     

    (the alerting is different to the examples here but I couldn't get the phone:msg syntax working, so I copied that from a LUA scene)

     

    This is fine except when the humidity is close to 80%, which causse the sensor reading to cross 80% repeatedly in a short time (80, 75, 80, 75... etc). Is there a way I can get a notification when the sensor crosses 80% the first time, and then only once per x minutes while the humidity remains high?

    I've seen the examples using again() but it doesn't seem to be quite what I want since I don't want the x minute delay on the first notification. I'm not clear if I use wait() at the end of the rule, whether it will block the rule from getting triggered again while it's waiting?

     

    A second question - I have 2 of these ACs (front room and back room). Currently I just have two separate rules but is there a clever way to collapse them into one rule, so that it triggers when either goes above the threshold, but then the timer applies to both after that (the rooms are next to each other, the humidity is obviously correlated). 

     

    Thanks!

     

    You could do

    Please login or register to see this code.

    The 'once' part will only be true when you cross 75 but it will not send a message unless value >= 80

     

     

    You want the combined above rule? The below could work... We only get a message when one of them goes over 80.

    Please login or register to see this code.

     

    There are 2 different ways for the push message depending on what id you have. See

     

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