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



jgab

Recommended Posts

20 hours ago, jgab said:

It should be compatible with v3. 

No improvements - still as complicated as before :-) 

This is a way to code using a "state machine", maybe I can come up with some syntax support for rules to make it easier to write. Will think about it.

Up and running with v3 now, just few changes (for and repeat)

@jgab possible to use "toggle" with huelights?

 

Please login or register to see this code.

 

Link to comment
Share on other sites

  • Topic Author
  • 14 minutes ago, jompa68 said:

    Up and running with v3 now, just few changes (for and repeat)

    @jgab possible to use "toggle" with huelights?

     

    Please login or register to see this code.

     

    Yes, I believe toggle should work. Do you get an error?

    Link to comment
    Share on other sites

    Did not try yet, did rewrite my alarm scene a bit and was thinking of using :toggle on my huelights when door opens when it is armed.

    Link to comment
    Share on other sites

  • Topic Author
  • New version V3, B34

    - Queueing up Hue commands so we don't overload the Hue bridge.

     

    • Like 1
    Link to comment
    Share on other sites

    Guest kallecux

     

    Hello!

     

    I became a real HR3 fan! Thanks for that great work!

     

    Is there a way to get something like a .cargo property on the HT elements?

     

    Then i could save on the HT element properties that i need at a later time again.

     

    For example: a lamp lights up in the intensity 35, as soon as a movement is detected, the lamp in the brightness 100 will light up. After x minutes the lamp switches back to 35.

     

    At the moment I solve this with a separate variable per lamp to store the :value.

     

    It would be elegant if you could save the 35 "at the lamp" to use this value later:

     

    Please login or register to see this code.

    Thanks - Karl Heinz

    Edited by kallecux
    Link to comment
    Share on other sites

  • Topic Author
  • 1 minute ago, kallecux said:

     

    Hello!

     

    I became a real HR3 fan! Thanks for that great work!

     

    Thanks!

    1 minute ago, kallecux said:

     

    Is there a way to get something like a .cargo property on the HT elements?

     

    Then i could save on the HT element properties that i need at a later time again.

     

    For example: a lamp lights up in the intensity 35, as soon as a movement is detected, the lamp in the brightness 100 will light up. After x minutes the lamp switches back to 35.

     

    At the moment I solve this with a separate variable per lamp to store the :value.

     

    It would be elegant if you could save the 35 "at the lamp" to use this value later:

     

    Please login or register to see this code.

    Tanks - Karl Heinz

     

    In general you don't need to store things in fibaro globals like where you store the HT. Because ER is running all the time you can use temporary ER/Lua variables.

    The HT is read in and you can use that structure to store additional elements. However, if you restart the scene the value will be lost.

    You could write out the HT once in a while to persist it but usually you don't need that.

    The save the value of a dimmer value before lightning it up to 100% and then restoring it back to the old value could look like below (we use the HT for temporary storage).

    Be aware that wohnzimmer.lampe is a "leaf" with a deviceID number as a value. To add something it needs to be a non-leaf node.

    Here we use wohnzimmer.lampeV (as in lampe Value)

    Please login or register to see this code.

    P.S If you have access to a PC or Mac I highly recommend setting up the off-line environment for developing and testing ER scenes.

    Link to comment
    Share on other sites

    Guest kallecux

    Is there a way to monitor a hue lamp only one time?

     

    Like: Hue.monitor(Schreibtisch,0)

     

    because the :value is wrong, when changed in background.

     

    Karl Heinz 

    Link to comment
    Share on other sites

  • Topic Author
  • 4 minutes ago, kallecux said:

    Is there a way to monitor a hue lamp only one time?

     

    Like: Hue.monitor(Schreibtisch,0)

     

    because the :value is wrong, when changed in background.

     

    Karl Heinz 

     

    How does you rule look like? 

     

    Do you turn off the lamp with a physical button?

    If you turn on/off the lamp with a rule

    "Schreibtisch:on" then the local database is instantly updated with the value.

    If you turn on/off the lamp with the Hue app or physical button you need to monitor it in the background to get the state change.

    Hue.monitor(Schreibtisch,1000) polls the lamp every second and you get a trigger when it changes vaue so the rules like

    "Schreibtisch:isOn => log('Hipp')" will work.

    Hue.monitor(Schreibtisch,0) turns off the monitoring of the lamp.

    If you have a sensor in a room you can turn on the monitoring of Hue lamps when someone enters the room and turn it off when it's not needed.

    "motion:breached => Hue.monitor(Schreibtisch,1000)"

    "trueFor(00:10,motion:safe) => Hue.monitor(Schreibtisch,0)"

    thus saving some resources.

    However, it doesn't cost that much to let monitoring run constantly (poll every 1-2 s)

    Link to comment
    Share on other sites

    Guest kallecux

    This is my rule:

    Please login or register to see this code.

    If i change the Hue-Lamp via Hue-App then value in the first rule is wrong. 

     

    Karl Heinz

    Link to comment
    Share on other sites

  • Topic Author
  • 36 minutes ago, kallecux said:

    This is my rule:

    Please login or register to see this code.

    If i change the Hue-Lamp via Hue-App then value in the first rule is wrong. 

     

    Karl Heinz

    If you add 

    Please login or register to see this code.

    it works?

    Link to comment
    Share on other sites

    @jgab need some help with an more advance rule that i do not now how to handle.

    want to add delay of post(#arm) so it will not start count before i have closed front door.

     

    This is what i have today

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

  • Topic Author
  • 36 minutes ago, jompa68 said:

    @jgab need some help with an more advance rule that i do not now how to handle.

    want to add delay of post(#arm) so it will not start count before i have closed front door.

     

    This is what i have today

    Please login or register to see this code.

     

     

    I think it looks ok. When you lock the door it will post an #arm in 2min. and cancel it of you unlock.

    Does it misbehave?

    Link to comment
    Share on other sites

    42 minutes ago, jgab said:

    I think it looks ok. When you lock the door it will post an #arm in 2min. and cancel it of you unlock.

    Does it misbehave?

    device 812 is my zipate keypad. 

    Link to comment
    Share on other sites

  • Topic Author
  • Ok, I'm coming out with V3, B40

    and there are some incompatible changes that will require you to update your scripts (for Hue and if you have started to use nodered())

     

    -Nodered()

    A new function Nodered() that replaces the nodered() with lowercase that came with V3.

    Please login or register to see this code.

    Instead of relying on a global _defaultNodeRed or _myNodeRed you make a connect(url) to the url you want inside main().

    You need to do a connect to setup the connection before you can do Nodered.post()

    Ex.

    Please login or register to see this code.

     

    -Hue()

    Hue is almost the same. The difference is that we don't rely on a global _HueHubs variable to initialise. Instead we have a dedicated connect() function that we call inside main  (like Nodered)

    Please login or register to see this code.

    Ex.

    Please login or register to see this code.

    The other difference is that Hue.define only takes 2 arguments now. Hue name and deviceID. deviceID is optional and if left out will be assigned to numbers starting at 10000...

    Hue.connect() still supports connecting to several Hue bridges. Just make several connects()...

     

    -Telegram()

    New function Telegram(). 

    Please login or register to see this code.

    The Telegram.bot command takes a bot_key and an optional tag (defaults to "Telegram") and will post incoming messages as

    {type=<tag>, user=<userid>, text=<text>,id=<chatID>, info=<info>}

    Telegram bot will also persist chatIDs, user names and bot_key in a fibaro global "TelegramUsers"

    If users are persisted, username or chatID can be used as <id> to Telegram.msg()

    If no users are persisted, {chatID,bot_key} can be used as <id>. Useful if you want to push a message without having started a bot.

    Ex.

    Please login or register to see this code.

     

    In this way we have a model for harmonising functions for integration with external systems and we don't need a lot of "global" initialisation variables spread across the code.

    Because we initialise them inside main() we can fetch configuration data from our HT or from user defined variables in the scene - whichever you prefer.

     

    I will push this version later today.

     

    Link to comment
    Share on other sites

    Good morning Jan,

    Looks very good to be all combined in main!

    Another big step forwards.

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    sorry for the picture where that is coming from?

     

    Link to comment
    Share on other sites

  • Topic Author
  • 1 hour ago, jgab said:

     

    I think it looks ok. When you lock the door it will post an #arm in 2min. and cancel it of you unlock.

    Does it misbehave?

     

    Ok, I haven't tested this but try it.... 

    Please login or register to see this code.

     

    22 minutes ago, Sjakie said:

    Good morning Jan,

    Looks very good to be all combined in main!

    Another big step forwards.

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    sorry for the picture where that is coming from?

     

     

    Good, the picture with the "Couldn't post event" scared me. Are you still getting those messages?

    Edited by jgab
    Link to comment
    Share on other sites

    4 minutes ago, jgab said:

    Ok, I haven't tested this but try it.... It may post #disarm even if it didn't post #arm, is that a problem?

    Will do, thanks :D

    Link to comment
    Share on other sites

    Hello Jan,

    What is better to do system wise?

    Using same device in two scenes >>>triggers often?

    as trigger or work with remote(111,#example)>>>>triggers once?

    Please advice

    Link to comment
    Share on other sites

  • Topic Author
  • 26 minutes ago, Sjakie said:

    Hello Jan,

    What is better to do system wise?

    Using same device in two scenes >>>triggers often?

    as trigger or work with remote(111,#example)>>>>triggers once?

    Please advice

     

    It's better  to let device trigger in both scenes.

    The remote thing is best for user defined events or if you add some extra info to a trigger.

    Link to comment
    Share on other sites

    Jan,

    the picture came from??????

    When I pushed submit this picture came with it, its a pic from the old arm scene, dont worry.

    Thanks

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