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


  • 0

Turn off all devices that controls "Lightning"


Lockzi

Question

Hi,

I got tired of having to add devices to a block scene to turn off...

Therefore I am trying to loop through all devices with LUA and send them turnOff.

The loop works fine, I get all ID: s, but the command "turnOff" is not working as they are still lit.

Please login or register to see this code.

Debug output:

Please login or register to see this code.

Any help to why "fibaro:call(i, "turnOff");" does not work is appreciated!

Regards,

Lockzi

[ Added: 2014-02-02, 17:24 ]

So, it actually worked. But only for dimmers. Relays are not even identified even though they have the Controlled Device: Lightning under advanced settings.

The reason is that for relays the ControlledTypeID is 2, and not 23 (as for dimmers...)

[ Added: 2014-02-02, 17:33 ]

Allright,

so final code that's working!

Please login or register to see this code.

You could easily reverse it by changing turnOff to turnOn.

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

I simplified the code a bit using the built-in isLight function, also added room name to the debug.

Here is my code:

Please login or register to see this code.

I believe it should be equivalent to yours

Please login or register to see this image.

/emoticons/default_icon_smile.gif" alt=":-)" />

Link to comment
Share on other sites

  • 0
Guest dsilletti

to speedup the scene and have a better log you should bypass all devices that are already off,

use:

Please login or register to see this code.

you will save a lot of time in scene execution and will loose the effect "turn off one by one" that is a little bit old fashioned, all devices will be turned off immediately

Please login or register to see this image.

/emoticons/default_icon_biggrin.gif" alt=":-D" />

Domenico

Link to comment
Share on other sites

  • 0
  • Inquirer
  • using the built-in isLight function

    I have to check if that includes the wall plugs, if so - good job!

    you will save a lot of time in scene execution and will loose the effect "turn off one by one" that is a little bit old fashioned, all devices will be turned off immediately

    Time in scene execution, it takes about 1 second or less for me to run through all my devices (Number of devices: 38.). Although I do indeed get the "one-by-one" effect...

    Will try yours too se if that resolves it!

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" /> Thanks

    Link to comment
    Share on other sites

    • 0
    Guest dsilletti
    using the built-in isLight function

    I have to check if that includes the wall plugs, if so - good job!

    you will save a lot of time in scene execution and will loose the effect "turn off one by one" that is a little bit old fashioned, all devices will be turned off immediately

    Time in scene execution, it takes about 1 second or less for me to run through all my devices (Number of devices: 38.). Although I do indeed get the "one-by-one" effect...

    Will try yours too se if that resolves it!

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" /> Thanks

    The difference in my case is noticeable, even if is something about 1 second or some sub-seconds

    Please login or register to see this image.

    /emoticons/default_icon_biggrin.gif" alt=":-D" />

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • using the built-in isLight function

    I have to check if that includes the wall plugs, if so - good job!

    you will save a lot of time in scene execution and will loose the effect "turn off one by one" that is a little bit old fashioned, all devices will be turned off immediately

    Time in scene execution, it takes about 1 second or less for me to run through all my devices (Number of devices: 38.). Although I do indeed get the "one-by-one" effect...

    Will try yours too se if that resolves it!

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" /> Thanks

    The difference in my case is noticeable, even if is something about 1 second or some sub-seconds

    Please login or register to see this image.

    /emoticons/default_icon_biggrin.gif" alt=":-D" />

    Unfortunately I can't get it to work.

    After running (it took less than 1 second to loop through all), I still have 17/29 lights on.

    What is defining the isLight variable for the devices? Seems like only relays are being turned off, not dimmers.

    Update:

    Sorry, completely missed the check for value == 1 (which is true for dimmers at only dim level 1 and all binary lights).

    I updated to code to the following that I am now running. Although I still get the same "one-by-one" and I ran neighborUpdate on all devices last night to optimise the z-wave network.

    Please login or register to see this code.

    Please login or register to see this code.

    Link to comment
    Share on other sites

    • 0
    Guest dsilletti
    using the built-in isLight function

    I have to check if that includes the wall plugs, if so - good job!

    you will save a lot of time in scene execution and will loose the effect "turn off one by one" that is a little bit old fashioned, all devices will be turned off immediately

    Time in scene execution, it takes about 1 second or less for me to run through all my devices (Number of devices: 38.). Although I do indeed get the "one-by-one" effect...

    Will try yours too se if that resolves it!

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" /> Thanks

    The difference in my case is noticeable, even if is something about 1 second or some sub-seconds

    Please login or register to see this image.

    /emoticons/default_icon_biggrin.gif" alt=":-D" />

    Unfortunately I can't get it to work.

    After running (it took less than 1 second to loop through all), I still have 17/29 lights on.

    What is defining the isLight variable for the devices? Seems like only relays are being turned off, not dimmers.

    Update:

    Sorry, completely missed the check for value == 1 (which is true for dimmers at only dim level 1 and all binary lights).

    I updated to code to the following that I am now running. Although I still get the same "one-by-one" and I ran neighborUpdate on all devices last night to optimise the z-wave network.

    Please login or register to see this code.

    Please login or register to see this code.

    Cool! I don't have dimmers so I didn't use the check for value >=1, anyway I will use your code so will be ready for dimmers too

    Please login or register to see this image.

    /emoticons/default_icon_biggrin.gif" alt=":-D" />

    P.S. In your debug as I can see all lights are switched on, so you have 1 scene to switch all off and another to switch all lights on?

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Please login or register to see this code.

    P.S. In your debug as I can see all lights are switched on, so you have 1 scene to switch all off and another to switch all lights on?

    Correct

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

    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
    Answer this question...

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