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

Lights automation [LUA][3.562+]


rafal.m

Question

Polska wersja:

Please login or register to see this link.

My idea for automation lights in the house. Example of usage...

The enter-room with dimmer. Every move event turn on the lights for 3 minutes and every open door event turn on the lights for 5 minutes. In the last counting minute the lights will dimm down to zero - softly.

Every move or opening the door event will restart counter to 3 or 5 minutes. Manualy turning on the lights will set counter to half hour and then any other event will not be able to set counter for lower time - manual control is a priority.

Summary:

- Automatic switching off lights after counting time.

- Extension of light time based on events (eg move, doors, etc.).

- Without interfering with the manual control.

- Each light has its own timer.

- Dimming light for a defined time.

- Easy access to functions from the scene.

and...

- Everything is based on one single virtual device,

- For presentation timer and counting using slider - one for each device.

- Switching the light in the scenes you can make in the traditional way, or...

- Or simply by setting the slider value (setting the timer) - nothing more!

- You can adjust the slider (timer) in many scenes together.

The whole is fully automated and is simple to implement!

And here's the recipe in a few steps:

1. Define a new virtual device with the following code as Main loop. Change only login and password for your HC2:

Please login or register to see this link.

2. Define the sliders for each device in your home that you want to control by timer. To do this, add a slider in the virtual device with content as below:

Please login or register to see this code.

Fields:

action must be always autoOff;

deviceId id of controlled device;

defaultTime (optionaly) - default timer when the switch is controling manualy;

defaultValue (optionaly) - default maximum dimmer value;

dimmTime (optionaly) - time of dimming on the switching off event;

NEW! wakeTime (optionaly) - wake up period in seconds if devcie is dead.

3. (Optionaly) For presentation on the home screen you can define two elements in that virtual device. One more slider witch id globalSlider and one label id globalLabel with title eg. Turning off:.

That's all.

Just a way to use this functionality in scenes:

Instead of selecting the turn on action, just select the action changes the slider to the virtual device to any value (in seconds). The light will turn on automaticly.

Good luck;)

And one more thing...

Please login or register to see this link.

to have new futures!

Update 1.3:

- added possibilites to set timer (slider) from scenes to any value (even lower than actual) by minused value (eg. -600).

Update 1.2:

- fixed slider values preview,

- added new parameter "wakeTime"

- few others.

Update 1.05:

- possibility to turn off by slider,

- possibility to controll time in any "direction" by main slider

- icons - with animation

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

- bug fixes

Please login or register to see this attachment.

Please login or register to see this attachment.

Please login or register to see this attachment.

Please login or register to see this attachment.

Please login or register to see this attachment.

Please login or register to see this attachment.

Link to comment
Share on other sites

Recommended Posts

  • 0

Thanks! Very usefull.

[ Added: 2013-10-04, 09:15 ]

I have implemented it. It works great. Except for the fact that the next time that i use a dimmable light it starts fully dimmed. Is there a way to set startup value for dimmer lamps using manual on?

I have the older dimmer module without de start value option

Link to comment
Share on other sites

  • 0
  • Inquirer
  • I have implemented it. It works great. Except for the fact that the next time that i use a dimmable light it starts fully dimmed. Is there a way to set startup value for dimmer lamps using manual on?

    I have the older dimmer module without de start value option

    Try to add this lines together:

    Please login or register to see this code.

    [ Dodano: 2013-10-08, 09:59 ]

    The new version has been loaded

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

    Update 8 X 2013 (v 1.05):

    - possibility to turn off by slider,

    - possibility to controll time in any "direction" by main slider

    - icons - with animation

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

    - bug fixes

    stoper-stop.png you have to add as main icon and assign also to main slider.

    stoper.png assign to the rest of sliders.

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • I have no succes with the latest version. It doens't work at all?

    What error do you have in Debug window?

    Link to comment
    Share on other sites

    • 0

    [ERROR] 12:29:24: line 308: attempt to perform arithmetic on a nil value

    this is line 308

    if (globalSliderId and globalSliderVId) then

    Its seems de globalSlider is manditory in this version

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Search this code (at line 305):

    Please login or register to see this code.

    and swap to this:

    Please login or register to see this code.

    What result is now?

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • It's working now. I added the globalSlider in the virtual device.

    btw the codeswap didnt help.

    Thanks

    Thanks for feedback. I'll try to fix that.

    Link to comment
    Share on other sites

    • 0

    Can this be used with a relay switch instead of dimmer? What do i need to change in your setup?

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Can this be used with a relay switch instead of dimmer? What do i need to change in your setup?

    Yes, of course. The code in slider has to look like this:

    Please login or register to see this code.

    Link to comment
    Share on other sites

    • 0
    Can this be used with a relay switch instead of dimmer? What do i need to change in your setup?

    Yes, of course. The code in slider has to look like this:

    Please login or register to see this code.

    Perfect, good piece of code. Replaced 3 other scenes with this.

    Link to comment
    Share on other sites

    • 0

    rafal.m, first of all great script! I have few bugs:

    1] if i move slider other then global, it will jump right back on time it was counting from. So if there is 3450 sec i move slider to 45 then it will jump right back to 3449. If I do that in Global slider, it works. In individual sliders it doesn't.

    2] viz picture HC2 3.570 graphics is repeating itself...

    feature: can't it display time in seconds and minutes?

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 1] if i move slider other then global, it will jump right back on time it was counting from. So if there is 3450 sec i move slider to 45 then it will jump right back to 3449. If I do that in Global slider, it works. In individual sliders it doesn't.

    That is not without reason. It is protection for setting time from scenes to lower value than actual counter. Example: if you have "move detect" scene whitch setting counter to 300 sec, you don't want situation, when that move decreses time after you switch lights manualy and counter starts from 3600 sec.

    Right now it's not possible to check if the slider was changed from scene or manualy by user, so protection working all the time.

    2] viz picture HC2 3.570 graphics is repeating itself...

    I'm working with new version of script. The "slider view" problem will be fixed by using percentage value instead seconds.

    feature: can't it display time in seconds and minutes?

    Good idea!

    Link to comment
    Share on other sites

    • 0

    Great work!

    I have a question or I do something really wrong. When I add the slider to 3 (minutes?) Then my lights go off after 1 minute and switch directly on again and so on and so on.

    Don't I understand the timing of the slider?

    thanks,

    Remco

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • When I add the slider to 3 (minutes?) Then my lights go off after 1 minute and switch directly on again and so on and so on.

    Are you clicked slider? Or setted it by scene to 3 minutes (180)?

    Don't I understand the timing of the slider?

    The slider is represents a direct of time (in seconds) to switch off. Thats all.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Yes I clicked the slider, but also tried it with a scene

    By click you can select only time from 1..100 seconds. Are you surre, you have right sliders parameters? Can you post here screenshoots?

    Link to comment
    Share on other sites

    • 0

    Yes, see below:

    [ Added: 2013-10-18, 16:07 ]

    Here my virtual device

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Here my virtual device

    You have two sliders with one device id=112. Delete one of them. Is that device is binnary swtch or dimmer?

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