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

  • Topic Author
  • 31 minutes ago, Sjakie said:

    sorry had allready C

    its saved but lights doest switch on or off now

    It should look like this (Note the ID should also be allLightsOn)

    Please login or register to see this image.

    /monthly_2021_07/107170911_Screenshot2021-07-02at14_17.26copy.png.8aa16c6f3c40657b5d6c310336ab8155.png" />

    Link to comment
    Share on other sites

  • Topic Author
  • 2 hours ago, jgab said:

    Well, use the property :armed directly on the partition

    Please login or register to see this code.

     

    The again() function returns the number times it has repeated. This allows you to do

    Please login or register to see this code.

    and you get 

    Alarm disarmed for 00:30 hours

    Alarm disarmed for 01:00 hours

    Alarm disarmed for 01:30 hours

    etc.

     

    '!' is the not operator so !3:armed is the same as 3:armed == false

    Link to comment
    Share on other sites

    Jan, That I have.

    Nothing on or Off

    The other is all Off instead of On

    Please login or register to see this image.

    /monthly_2021_07/afbeelding.png.63162f6c0deae5803238d10742b8fc15.png" />

    //Sjakie

    Link to comment
    Share on other sites

    5 hours ago, jgab said:

    Check if you have some invisible characters around the "=>". Rule 9 compiles and I copied both rules to my emulator and they compile there too.

     

    So I did some tests with a false thermostat QA and it works quite well for me. 

    Note that rules are only triggered when the thermostat change the property value that you use in the test.

    A "trueFor" rule will not start to watch the property until the property changes value.

    However, you can force the rule to run when it is defined by adding .start()

    Ex.

    rule("trueFor(00:01:00,(ACScara:thermostatMode=='Off')) => log('test 2 OK')").start()
    rule("trueFor(00:01:00,(ACScara:thermostatFanMode=='High')) => log('test 3 OK')").start()

    That causes the rule to be triggered when the QA starts up and if the ACScara:thermostatMode is 'Off' the trueFor will start monitoring the property. Note that the time is measured from when the rule triggers so if the thermostatMode property has been off for a long time it only counts from when it is triggered.

     

    Invisible characters ? That was spot on !!! deleted those spaces then made them again and it works.

     

    I had no clue about the .start() - and indeed this solves it.

     

    All good now :)  Thermostats work very well !!!!

     

    Thank you very much @jgab ?

     

     

    Link to comment
    Share on other sites

    On 7/1/2021 at 3:06 PM, jgab said:

     

    Hi, the || >> is fixed now. Pushed 0.5fix63

    Note that you need to use ;; the end the ||>> sequence.

    Because the actions to the right of the >> can be a sequence of statements separated by ';'.

    Therefore the compiler needs a double ';;' to signal that the sequence has ended. 

    Ex.

    Please login or register to see this code.

     

     

     

    isValue? 

     

    instead of "1235:isOn" i would like to do "1235:is7" so i tried the the "||" checking for 1235 is 7, but it dont run the 

           fibaro.call(1235, "close");
           fibaro.call(1236, "close");;

    I guess my syntax "1235 == 7" is wrong, i also tried with one "=" but that dont compile

    I see the "  log('Closing windows');" in the log - so i know the rule triggers

     

    Please login or register to see this code.

     

    Edited by ChristianSogaard
    P
    Link to comment
    Share on other sites

  • Topic Author
  • 3 minutes ago, ChristianSogaard said:

    isValue? 

     

    instead of "1235:isOn" i would like to do "1235:is7" so i tried the the "||" checking for 1235 is 7, but it dont run the 

           fibaro.call(1235, "close");
           fibaro.call(1236, "close");;

    I guess my syntax "1235 == 7" is wrong, i also tried with one "=" but that dont compile

    I see the "  log('Closing windows');" in the log - so i know the rule triggers

     

    Please login or register to see this code.

     

    So 1235 is a device.

    Do you want to check the value property of 1235?

    1235:value == 7

    or does the 7 represent something else?

    Link to comment
    Share on other sites

    4 minutes ago, jgab said:

    (I seems to do this

    Please login or register to see this link.

    - so here comes the 2021 version)

     

    I joined this forum Dec 31, 2013. I believed I bought the HC2 a bit earlier - maybe it was an Xmas present to myself. I'm far from the oldest on this forum, just saying I done my years and have seen hopes and illusions come and go.

     

    We had just moved into a new house and this was affordable compared to ex. KNX and it was easier to tinker with. Just a hobby - which it still is.

     

    I'm kind of an "open systems" guy, and when I looked at the market I really believed that we would see a split between the switches/sensors and the systems that control them. Z-wave at that time seemed promising, and then we got more technologies... 

    So if the KNX is the "mainframe" of home automation, the z-wave, zigbee etc was the "PC" incarnation - and we know how it went for PCs and mainframes. Scale and ease-of use wins. PCs came in many models, CPUs and OSes, but I believe that Matters can take this to the next level and we could start to see the real "PC" effect. ( @lazer's Internet comparison holds also)

     

    Then one can ask if Fibaro has chosen the right market strategy. I don't really care if they survive or not but it's always interesting how companies go about positioning themselves in the market. Companies strategies are never crystal sharp as it is always tempting if there are money on the table, even if it's a bit outside their main focus. This can be seen as experimentation and business building but it can also be a distraction.

     

    In any case, it seems like their main vision is to sell boxes at bulk together with switches for new buildings or homes - served by installers. Betting it will be a market served by electricians and plumbers alike.

    This sets them up as a B2B company - which is very different from a B2C company - it's hard to be both - one will always be subpar to the other. Fibaro has a foot in B2C too, but you get the feeling that the other leg is winning internally. The "life style" commercial ads we see on their site is really meant for the guy with the tool belt to convey when he talks to his customers...

    I work at a "small" company named Ericsson and we can argue that we didn't get consumer phones. Nokia had bit more consumer background (TV sets and tires ;-) ) but when phones became mainstream the market changed towards Samsung and Apple. (Google's position is a post in itself - but they prefer the scalable hands-off consumer relationship that don't fly in all markets). The next step for our market is when telecom becomes Internet and how operators and vendors to position in that market, but that's another topic.

     

    So today we have electric motors and microprocessors everywhere in our homes in ways that we are not even aware of. Most of our light switches are still mechanical but it is not far fetched to imagine a future where standard switches, electric gates, locks, roller shutters and sockets from Schneider et.al comes with built-in Matter control.

    And then you go to your local consumer electronic shop and complement with sensors for the children rooms, etc.

     

    ...then it's suddenly a consumer market. Built-into appliances and buildings and connections decided by the consumers.

     

    There will be competition who can offer you the best orchestration/control of these devices - from the cloud, from the smartphone, from a dedicated box in your home. This "control" will be a separate market where "comes with the newest and shiniest AI algorithms" will be selling arguments. - and of course Google, Apple and Msft will be big players here just because of their size - but there are more aspects to this including who you trust handing over your home to...

     

    So Fibaro makes good switches and they should do the best Matter switches to stay in that market - and they could probably add some cleverness/intelligence/design to the actual switches to differentiate and get a premium price for them... and get a heads start on Schneider et.al before they understand the real importance and stop toying around.

     

    However, if they want to stay in the "control" part I would like to see them move faster in how they evolve that component. Looking at some of the open source systems with hundreds of contributors and hundreds of commits weekly and hundreds of plugins and protocol support the HC2/HC3 can look a bit ...slow and featureless. The innovation you attract as a successful open source system is amazing and you don't get that from just installers...

     

    They can still earn money on a box with good (I was about to say "nice") radio support to run the control system - even if it's open source - lot's of people don't want a PC on all the time. Can you make a box that is worth 4x what a Pi with a zigbee&z-wave stick cost? I guess you can if your box is easier to develop for and thus attracts more innovation and thus more interesting functionality for consumers that just wants to buy a box that solves their current and future home automation tasks in the best way... and don't want to tinker themselves. 

    That's why people buy an iPhone or Android - it's all the apps and innovation these platforms enable - and Apple and Google compete on their Developer conferences who has the coolest development platforms with the most features.

     

    Anyway, the HC3 is a step up for developers. The QA model that allow us to write "real" devices and some additional network protocol support like MQTT and WebSockets are steps in the right direction.

    What is severely lacking is still:

    • Lua library support - more of the Lua community standard libraries and support for installing your own.
    • A authorisation model that tells what user code is allowed to do. Like, installing libraries, access internet, access other devices, update system properties etc. Code should be treated as a user. Like on iOS or Android.
    • Enable the rest of the Lua language - metatables and coroutines. Probably only os.execute that needs to be censured and then provide versions of require/load that respects the current environment.
    • Make a decent event system. /refreshStates is nice to have but it could be so much more efficient if callbacks for specific events could be registered - getting away from the constant polling ...and then leverage the same system for QAs and Scenes (and btw, make them both Lua5.3 and with class support - conditions is never to be easy to use for new comers...)
    • UIs... I don't know what to say. Open up the protocol for third party (phone) applications or spend some more efforts on it.

    The box could of course also be more powerful but I still think there are a lot of possible improvement to get a more stable performance out of the existing HW. Not everything will fit on the box and integration support to MQTT and other service is a must. Fibaro could even offer their own remote services to the box. Notifications, positioning, IFTTT are such services (that could improve) but why not offer more developer back-end services. Storage, time-series DB, ML inference engine, etc. As a developer I can call out to AWS or Google but it becomes difficult if someone else is using my code as they need to setup all these resources and relationships (or I come up with a charging model...). If it's valuable enough it could warrant Fibaro to extend their business model with subscriptions. 

     

    Then of course before everything is Matter the question is how to support developers with a homogenous device (QA) model that allows legacy devices (z-wave, nice etc) as well as Matter.

     

    1 minute ago, jgab said:

    So 1235 is a device.

    Do you want to check the value property of 1235?

    1235:value == 7

    or does the 7 represent something else?

    1235 is a Velux windows - and 7 is a special position of it. how much its opened,

    Edited by ChristianSogaard
    P
    Link to comment
    Share on other sites

  • Topic Author
  • Just now, ChristianSogaard said:

     

    1235 is a Velux windows - and 7 is a special position of it.

    and the position (7 in this case) is reflected in the value property of the device?

    then do

    1235:value == 7

    • Thanks 1
    Link to comment
    Share on other sites

    -- Convert a External IFTTT Sceene trigger to EventRunner4
    Util.defTriggerVar("SiemensCookTop",0)
    rule("#sceneEvent{id=171,value='started'} => SiemensCookTop = 1; post(#SiemensCookTop{1})")
    rule("#sceneEvent{id=172,value='started'} => SiemensCookTop = 0; post(#SiemensCookTop{0})")

    Please login or register to see this code.

    This two rule converts an external IFTTT Scene to a trigger in EV4 - SiemensCookTop on/off.

    Im using these triggers to start other actions link - like open Velux windows and start extractor hood, Control Nilan Ventlation.

    Just wondering if there is Needless tings in these rules - because im think i lack some basics understanding, the Cooperation between thedefTriggerVar, and the SiemensCookTop = 1; post(#SiemensCookTop{1}?

     

    Link to comment
    Share on other sites

  • Topic Author
  • Yes, that's a clever way to integrate with IFTTT. Are the scenes empty also?

    The only pity is that it requires a scene for every signal - would be nice to pass on some arguments from IFTTT to the scene.

     

    Anyway, declaring 'SiemensCookTop' as a triggerVar allows the variable to be used as a trigger in other rules.

    Ex.

    Please login or register to see this code.

    It's kind of an event but it will only trigger rules when it changes value. Because in your case you initiate the variable to 0 it will only trigger this rule when it changes to 1 and then back to 0.

    You could initialise it to nil Util.defTriggerVar("SiemensCookTop",nil), and it will trigger the rule the first time it gets a value.

    Then you also send an event #SiemensCookTop{1}. The #-syntax makes this equivalent to sending

    Please login or register to see this code.

    which is not that good as you mix key-value and array (1-index). It's allowed in Lua but is a mess and ex. json.encode will not encode such tables.

    If you need to send an event I would do 

    Please login or register to see this code.

    which is the same as

    Please login or register to see this code.

     

    Then other rules can trigger on

    Please login or register to see this code.

     

    So it's two different mechanism. Now you use both - the belt and suspenders approach - and you could choose one.

    The advantage with triggerVars are that they "keep their values" around while events "disappears" after they are sent. 

    On the other hand triggerVars only trigger when they change values but rules can trigger on the same event being posted many times.

     

    Another rule of thumb is that triggerVars are ok for single values like numbers and strings. Table values are better expressed as events.

    • Thanks 1
    Link to comment
    Share on other sites

    5 minutes ago, jgab said:

    Yes, that's a clever way to integrate with IFTTT. Are the scenes empty also?

    The only pity is that it requires a scene for every signal - would be nice to pass on some arguments from IFTTT to the scene.

     

    Anyway, declaring 'SiemensCookTop' as a triggerVar allows the variable to be used as a trigger in other rules.

    Ex.

    Please login or register to see this code.

    It's kind of an event but it will only trigger rules when it changes value. Because in your case you initiate the variable to 0 it will only trigger this rule when it changes to 1 and then back to 0.

    You could initialise it to nil Util.defTriggerVar("SiemensCookTop",nil), and it will trigger the rule the first time it gets a value.

    Then you also send an event #SiemensCookTop{1}. The #-syntax makes this equivalent to sending

    Please login or register to see this code.

    which is not that good as you mix key-value and array (1-index). It's allowed in Lua but is a mess and ex. json.encode will not encode such tables.

    If you need to send an event I would do 

    Please login or register to see this code.

    which is the same as

    Please login or register to see this code.

     

    Then other rules can trigger on

    Please login or register to see this code.

     

    So it's two different mechanism. Now you use both - the belt and suspenders approach - and you could choose one.

    The advantage with triggerVars are that they "keep their values" around while events "disappears" after they are sent. 

    On the other hand triggerVars only trigger when they change values but rules can trigger on the same event being posted many times.

     

    Another rule of thumb is that triggerVars are ok for single values like numbers and strings. Table values are better expressed as events.

    Thank you for taking your time to explain to me :-)

    My IFTTT triggered scenes have just one line

    Please login or register to see this attachment.

     

    • Like 1
    Link to comment
    Share on other sites

  • Topic Author
  • What about this IFTTT scheme.

     

    The automation script on IFTTT stores a value in some easy to use but personal storage service. Google calendar, docs, etc... Then it sends a start scene to your HC3.

    That scene picks up the value from that external storage service and act upon the value.

    This would only require one scene for integration.

     

    The question is just what that service is... It should be quick to access the value from the HC3. Telegram? or?

    Link to comment
    Share on other sites

  • Topic Author
  • 3 minutes ago, jgab said:

    What about this IFTTT scheme.

     

    The automation script on IFTTT stores a value in some easy to use but personal storage service. Google calendar, docs, etc... Then it sends a start scene to your HC3.

    That scene picks up the value from that external storage service and act upon the value.

    This would only require one scene for integration.

     

    The question is just what that service is... It should be quick to access the value from the HC3. Telegram? or?

    @ChristianSogaard Do you know if IFTTT can turnOn/turnOff/Toggle a QA? Then you have 3 signals in one QA.

    Link to comment
    Share on other sites

    6 minutes ago, jgab said:

    @ChristianSogaard Do you know if IFTTT can turnOn/turnOff/Toggle a QA? Then you have 3 signals in one QA.

    I'm pretty sure you only can trigger a scene, i'm logging into ifttt to check if things changed - stay tuned

    Link to comment
    Share on other sites

    So before building more ... please comment on the structure.

    Extractor hood step  rules - decode my extractor power value into steps and light on/off

    SiemensCookTop - is external triggers from IFTTT.

     

    and these uses the output from extractor and cooktop - to trigger the actual actions - like open windows for better flow

    Please login or register to see this code.

     

     

     

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

  • Topic Author
  • This don't work (you missed a '}' at the end of the last event but that's not the real problem)

    Please login or register to see this code.

    You can't trigger on 2 events. Events trigger rules one by one, and when it triggers on #SiemensCookTop

    the #Extractor test will be false. There is no "memory" of what events has happened in the past.

    In this case I would suggest that you make SiemensCookTop and ExtractorStep triggerVars so that you can test easily. 

     

    Please login or register to see this code.

     

    • Thanks 1
    Link to comment
    Share on other sites

    19 minutes ago, ChristianSogaard said:

    I'm pretty sure you only can trigger a scene, i'm logging into ifttt to check if things changed - stay tuned

    So...

    This is what IFTTT can do in HC3 

    Please login or register to see this attachment.

     

    In the dropdown in IFTTT i only see very few of the QA i have in my HC3.

    one was the BlastBot, but trying to select BlastBot QA it fails, the trying to do the toggle 

    Please login or register to see this attachment.

     

    Perhaps because there arent any toggle in the QA ?

     

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    Please login or register to see this attachment.

     

    So I'm using SCENE Triggers

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    On 7/17/2020 at 10:15 AM, jgab said:

    EventRunner4. v 0.5 fix 59 -  

    Please login or register to see this attachment.

     

    I have made an overhaul of the alpha version I released earlier and I'm starting to run ER4 for some of my stuff at home now. I will upload new versions to my GitHub and .fqa version in this post. ER4 has some changes from ER3.

    • First off, ER4 is a QuickApp, not a Scene. Inside rules there is a variable 'QA' that is the 'self' of the ER4 QuickApp. You can use that to call QuickApp methods if needed.
    • There is no need to declare specific triggers in the headers like we did with HC2 scenes. However, there is a need to declare what types of triggers you want to receive. That is to prevent the rule system to be flooded by triggers you are not dealing with anyway.
    • Builtin support for Hue is removed. I recommend using plugins that make your Hue devices behave like standard devices (QAs) and you can then use them in rules like any other device. I have a Hue QuickApp here for Hue lights and sensors.
    • There is no VDs to interact with. Instead we call other QAs with fibaro.call(id,<function name>,args...). fibaro.call can be made from within rules.
    • ER4 has gone through re-write making ER3 and ER4 not sharing code which mean that I will not further evolve ER3 (but fix bugs). ER4 is now based on the

      Please login or register to see this link.

      though, that I develop for other projects. It gets the trigger and event handling from that toolbox.  

    A minimal startup look like ('main' file)

    Please login or register to see this code.

    There are changes when it comes to how devices behave between the HC2 and HC3. Ex. what type of property values they expose and use. These days I don't have that many types of devices so if you have a device that doesn't work in event scripts please let me know and we can fix it together.

     

    The HC3 is still a bit wonky when editing/saving and watching logs for QAs. I highly recommend that you use the

    Please login or register to see this link.

    to develop ER4 rules on a PC/Mac before deploying on the HC3. The emulator can run the full EventRunner4.lua code and interact with your real devices on the HC3. It will save precious time and significantly reduce frustration...

     

    • Please login or register to see this link.

      (and ER3) - TBD
    • Please login or register to see this link.

     

    Here is a video on how to install the EventRunner4 QuickApp.

    (there should be subtitles with instructions)

     

    Watch the video, install the QA, feel free to post questions how to write rules in this thread and I will happily help you :-)

     

    Use cases:

    • Please login or register to see this link.

    • Please login or register to see this link.

    • Please login or register to see this link.

       (timers. & triggers)
    • Please login or register to see this link.

     

    v.0.3 fix1. "Initial version"

    v.0.3 fix2. Forgot _ENV...

    v.0.3 fix3. fixed sceneActivation Event

    v.0.3 fix4. :manual is back. Returns seconds since manual interaction with device. returns -1 if script changed device. only for 'value' properties.

    v.0.4 fix2. New QA file format. Rules are in 'main' file. File 'EventRunner' and 'Toolbox' should not be touched. Autoupdate is back.

    v.0.4 fix3. More modular toolbox

    v.0.5 fix3 New internal structure and pub/sub mechanism. New auto patch.

    v.0.5 fix8. Many fixes...

    v.0.5 fix22. ...and many more fixes

    v 0.5 fix32 ... ... and even more fixes

    Hi jgab,

    I am new to lua and i want to use EventRunner4 on HC3, in "installation guide" is fqa file but in post is EventRunner4.lua file to download. Please how can i upload this lua file? If i try to upload as QA i get error. I also try to find answer on forum but with no success.

    Thanks

     

    Link to comment
    Share on other sites

  • Topic Author
  • 10 minutes ago, kubo said:

    Hi jgab,

    I am new to lua and i want to use EventRunner4 on HC3, in "installation guide" is fqa file but in post is EventRunner4.lua file to download. Please how can i upload this lua file? If i try to upload as QA i get error. I also try to find answer on forum but with no success.

    Thanks

     

    Thanks, to pointing me to this error - I had uploaded the wrong file. Now the .fqa is linked.

    I would advise you to uncomment the rules

    Please login or register to see this code.

    to get automatic updates of the QA when I release new versions (your rules stay the same, it's just visible as a restart of the QA)

    Link to comment
    Share on other sites

    Jan,

    how to use location in ER4?

    Rule.eval([[location==enters => 20:msg='1303-LET OP; User 29 arrived at home']])
    Rule.eval([[location==leaves => 20:msg='1303-LET OP; User 29 left home']])

    //Sjakie

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