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

@jgab

want to add an more function to my rule, if power is less than 3 and deviceID isOn and motion sensor breached than post to Nodered.
Speak should continue every xx minutes when motion occur until device is Off or power is more that xx.(started a new wash)
Got some inspiration from @cag014 AOS

Possible to handle that with todays code?

Please login or register to see this code.

 

Link to comment
Share on other sites

  • Topic Author
  • 2 hours ago, jompa68 said:

    @jgab

    want to add an more function to my rule, if power is less than 3 and deviceID isOn and motion sensor breached than post to Nodered.
    Speak should continue every xx minutes when motion occur until device is Off or power is more that xx.(started a new wash)
    Got some inspiration from @cag014 AOS

    Possible to handle that with todays code?

    Please login or register to see this code.

     

     

    If you just add an 'again()'? it will repeat as long as the condition in trueFor is true? Is that what you were after?

    Please login or register to see this code.

    I'm not sure I understand the use case fully. If it's a motion sensor in the laundry room shouldn't it give notifications if no one is there?

     

    Btw, Everything is possible to do in ER :-) 

    Link to comment
    Share on other sites

    7 hours ago, jgab said:

    I'm not sure I understand the use case fully. If it's a motion sensor in the laundry room shouldn't it give notifications if no one is there?

     

    Want to use motion in kitchen, when they are triggered my sonos should remind about the laundry. And repeat speak(if motion) every xx min until plug is turnOff or next laundry is started

    Link to comment
    Share on other sites

    Good morning @jompa68 &@jgab,

     

    thanks for this beautiful rule.

    Will implement it too for some other message what needs to be repeat.

    Have a nice weekend

    //Sjakie

    Link to comment
    Share on other sites

  • Topic Author
  • 2 hours ago, jompa68 said:

    Want to use motion in kitchen, when they are triggered my sonos should remind about the laundry. And repeat speak(if motion) every xx min until plug is turnOff or next laundry is started

     

    Ah, then I would do like below. Every 5min the power is < 3 and the machine is on it will test if the sensor is breached in the kitchen and then play a message.

    I guess the reason is that you don't want to play a message if no one is in the kitchen.

    Alternatively, instead of just testing "kitchen:breached", you could test "(kitchen:breached | kitchen:last < 30)", then it will trigger even 30s after the sensor becomes safe - if people have a tendency to stand still in the kitchen.

    Please login or register to see this code.

    Another approach is to split it up into more rules. One rule to decide if the laundry is finished and another to play a message if someone moves in the kitchen.

    Please login or register to see this code.

    Now it will play when the sensor is breached and the washing is ready, and then play again every time the sensor is breached.

    Another variant

    Please login or register to see this code.

     

    Edited by jgab
    Link to comment
    Share on other sites

    if i want to reduce TTS so it will not send every time motion is triggered, can i set :last to 900. Means it sends TTS every 15min?

     

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

  • Topic Author
  • 38 minutes ago, jompa68 said:

    if i want to reduce TTS so it will not send every time motion is triggered, can i set :last to 900. Means it sends TTS every 15min?

     

    Please login or register to see this code.

     

     

    That rule would not repeat until the sensor gets breached again.

     

    You want it to notify every 15min while it's breached, or every 15min when it's breached? 

    The third solution does it while it's breached. It means that the sensor needs to be breached continuously in 15min (which may not be true that often even if you are in the kitchen)

    Please login or register to see this code.

    Another approach. is just to make sure you don't notify more often then every 15min when the sensor is breached. 

    So the first time you breach it you notify and then you ignore breaches until it has gone 15min before notifying on a new breach,

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    28 minutes ago, jgab said:

    Another approach. is just to make sure you don't notify more often then every 15min when the sensor is breached. 

    So the first time you breach it you notify and then you ignore breaches until it has gone 15min before notifying on a new breach,

    Ah, this will be perfect. Thanks ?

    Link to comment
    Share on other sites

     Well done... that's exactly the purpose of this forum.. information and ideas sharing

    Edited by cag014
    Link to comment
    Share on other sites

    I do both.

    The hardware button, we are at home by breaching the motion sensor>>>needs to be reset for other scenes to run. Works great!!

    Washing machine with interval.

    I agree messages must be use full and not to many other wise the purpose is gone.

    Thnaks

    //Sjakie

     

    Link to comment
    Share on other sites

    18 hours ago, jgab said:

    Btw, Everything is possible to do in ER :-) 

    Yeah with BIG help from you

    Link to comment
    Share on other sites

  • Topic Author
  • 2 hours ago, jompa68 said:

    Yeah with BIG help from you

    Well, home-automation is deceitfully easy.

    Many ideas I have had have turned out to be difficult in practice, due to asynchronous events and idiosyncratic family members ;-)

    So even if you come up with the easiest framework ever to express home automation rules it will still be difficult to capture every users
    expectation and intention - because usually they don't even know it themselves (that includes me)..

    When it comes to frameworks it is the whole spectrum from "configurations" to "coding rules" - from GEA, @Sankotronic's home automation suite, to various schedulers, to the latest from @cag014 to my own ER that has gone all the way to become a fulle fledge programming language.

    It becomes a trade-off between ease-of-use and expressiveness. We try to abstract away Lua but it's coding anyway - cause and effect. For novices it can make sense to limit expressiveness, aka choices and keep them within some well defined use cases - the problem is of course that novices learn and start to dream bigger home automation dreams...

    From an ER perspective I try to capture "home automation idioms" to do the impossible; make it easy to express (easy) rules, while still maintaining flexibility to express any complex rules.

    I really like when users post "problems for me to solve", and I can help them because it makes me reflect on if this is something that is "easy" to solve in the existing script language or if it would

    benefit from some new construct - many extension to eventscript has evolved that way. 

    But it comes back to how I started the post - home automation is in general easy but in any particular case difficult - no matter what framework you use.

     

    Link to comment
    Share on other sites

    @jgab

    You're absolutely right, there is no way to anticipate future requests (as you said, even we cannot ) and I think it's a huge advantage that users have  a few choices to select from:  your ER, @Sankotronic HA, my AOS and of course they can use Lua.

    Based on my experience during last years I have switched my view on what missing in HA environment  and came to conclusion that the main difficulty is not how you create events (as you mentioned we just come up with a new "high level" language), but how to have a good view and history on what/when/how events run. Usually if something behaves not as expected, we need historical chain of events, values and actions to understand what went wrong. Fibaro's event panel gives some view, but it isn't so efficient.That's my target in AOS, to provide current view and what/when/how events will be executed and as much as possible history of values, executed commands, states and status. View on Z-Wave performances and  devices behavior. I have been tired to dig inside VD, scenes and devices to find the problem (and to add more and more debug information).

    I don't know if this is the right direction, but meanwhile it serves me very well.

    Basically my point is that we need to concentrate more on how to provide comprehensive debug information,  like compiler, when you have an error you need a good info and explanation what the error is, otherwise it's impossible to fix the problem.

    An excellent example for missing information and analyze tools is endless complains, from users in this forum, on system crashes with no ability to understand why it's happening. Users have scenes to reboot their system every few days !!!!!

    As you stated:

    home automation is in general easy but in any particular case difficult - no matter what framework you use.

     

     

     

     

     

     

     

    Edited by cag014
    Link to comment
    Share on other sites

    Good morning,

    Thanks @jagab, @Sankotronic,@cag014.

    for the excellent base they provide.

    As newbie I can tell you its very difficult to understand what is happening behind the scene.

    With your help our home is rather automated. Our ground floor is almost completed in automation I thought: Jompa came with a repeating of the washing machine message, Gag came with a nice idea for the oven so we will evolve!

    This weekend I got a compliment after I informed someone to put the light of the bath room off.

    Sjakie everything goes automatically in your house so I did not think to switch it off! Okay I will start with that too to automate.

    Thanks again and keep up the good work,\

    //Sjakie

     

     

    Link to comment
    Share on other sites

  • Topic Author
  • 12 hours ago, cag014 said:

    @jgab

    You're absolutely right, there is no way to anticipate future requests (as you said, even we cannot ) and I think it's a huge advantage that users have  a few choices to select from:  your ER, @Sankotronic HA, my AOS and of course they can use Lua.

    Based on my experience during last years I have switched my view on what missing in HA environment  and came to conclusion that the main difficulty is not how you create events (as you mentioned we just come up with a new "high level" language), but how to have a good view and history on what/when/how events run. Usually if something behaves not as expected, we need historical chain of events, values and actions to understand what went wrong. Fibaro's event panel gives some view, but it isn't so efficient.That's my target in AOS, to provide current view and what/when/how events will be executed and as much as possible history of values, executed commands, states and status. View on Z-Wave performances and  devices behavior. I have been tired to dig inside VD, scenes and devices to find the problem (and to add more and more debug information).

    I don't know if this is the right direction, but meanwhile it serves me very well.

    Basically my point is that we need to concentrate more on how to provide comprehensive debug information,  like compiler, when you have an error you need a good info and explanation what the error is, otherwise it's impossible to fix the problem.

    An excellent example for missing information and analyze tools is endless complains, from users in this forum, on system crashes with no ability to understand why it's happening. Users have scenes to reboot their system every few days !!!!!

    As you stated:

    home automation is in general easy but in any particular case difficult - no matter what framework you use.

     

    Yes, I do agree that the test and monitoring is severely lacking. I'm one of the fortunates that never had any serious issues with my z-wave network (knock-on-wood) - but I have sympathy for those that wrestle with that aspect on a daily basis.

    I've developed my own

    Please login or register to see this link.

    that runs in ZeroBrane Studio (and possibly any Lua IDE that supports mobdebug.lua) and allows me to debug and test complex scenes - allows me to replay triggers and events to see if the scene behaves in expected ways, and also speed up and down the time. It has increased my productivity exponential compared to trying to do things on the HC2. Without it, there would be no chance at all that I had managed to develop ER). When users of ER has problems I can bring in their scenes in my emulator, replay troublesome sequences of triggers/events and usually find a problem in their rules - or in my own ER code - very quickly. It's good enough to run multiple scenes in parallell and complex scenes like ER or GEA. Unfortunately I can't test AOS in the emulator as I never anticipated someone using the log window in that way.... ;-) - doesn't fly with Zerobranes log window.

    My point is that good debugging is a must in any code development and in a highly asynchronous model as home automation tends to be it is even more crucial. Fibaro choose a simple model with triggers, scenes and scene instances - this becomes very complex when trying to do something slightly more complex - and they gave us no tools to handle it. (I have

    Please login or register to see this link.

    , and I would prefer an "event loop" model as talked about later in that thread).

     

    The developer of ZeroBrane has the Lua module mobdebug.lua that if included in the code allows the code to be remotely debugged from ZeroBrane (the runtime needs to expose some of the debugger hooks that is sandboxed in the HC2 at the moment). Many embedded Lua based platforms leverage it, and there is even a special version for

    Please login or register to see this link.

    . That would have been cool to support from the HC2. 

    Link to comment
    Share on other sites

    On 10/20/2019 at 1:06 PM, jgab said:

    Another approach. is just to make sure you don't notify more often then every 15min when the sensor is breached. 

    So the first time you breach it you notify and then you ignore breaches until it has gone 15min before notifying on a new breach,

    Post value looks and sounded odd. Think it did say "washing" but not sure

    Please login or register to see this code.

    Found the error, this is the correct line. 

    Please login or register to see this code.

    old

    Please login or register to see this code.

    Complete code

    Please login or register to see this code.

     

    Edited by jompa68
    Link to comment
    Share on other sites

  • Topic Author
  • 47 minutes ago, jompa68 said:

    Post value looks and sounded odd. Think it did say "washing" but not sure

    Please login or register to see this code.

     

    Sorry, I wrote code without testing it.

    The 'what' should be an index into the 'messages' table to get the real message.

    You could ofcourse also do the Nodered command directly in the "kitchen:breached & washingReady & now >=" rule if you want.

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    Hi Jan,

    What to write as rule?

    Rule.eval([[keuken.combiOven:value  >20<250 => start:2222; log('TRIGGER:%s',tjson(env.event))]])

    //Sjakie

    Link to comment
    Share on other sites

    Jan,

    Have you used this to replace all your automated lighting?

    I'm looking to replace my own code, but haven't found anything yet that does what I want which is to manage all zones from one place - which is roughly what my automated lighting does (albeit I wrote it 5 years ago and it needs an hug overhaul and tidy up)

    I can't have duplicate scenes for each zone as it is too much maintenance to go into so many different places when I want to make a change or when the code gets updated.

    Regards

    Aleks

    Link to comment
    Share on other sites

  • Topic Author
  • 10 hours ago, Sjakie said:

    Hi Jan,

    What to write as rule?

    Rule.eval([[keuken.combiOven:value  >20<250 => start:2222; log('TRIGGER:%s',tjson(env.event))]])

    //Sjakie

     

    Please login or register to see this code.

     

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