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+]


Question

Posted

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.

Recommended Posts

  • 0
Posted

Hello,

I tried this code and got it working easily! Thank you for this wonderful piece of LUA. But after a while (2hours) it stopped counting time. I checked the LUA and suddenly this pops up:

Please login or register to see this attachment.

  • 0
Posted

I have the same problem here, I keep receiving the same error ?!!

Line 80: expected object key string but found T_OBJ_END at character 93

  • 0
  • Inquirer
  • Posted
    I have the same problem here, I keep receiving the same error ?!!

    Line 80: expected object key string but found T_OBJ_END at character 93

    The same problem as above... comma at the end of sliders definitions. Check your code. It has to look like this:

    Please login or register to see this code.

    Not like that:

    Please login or register to see this code.

    Comma at the last line is not needed!

    • 0
    Posted

    Hello, I made same script to my friend but there is another issue now..

    ERROR: line 102: attempt to concatenate global "deviceValue" (a nil value)

    • 0
  • Inquirer
  • Posted
    Hello, I made same script to my friend but there is another issue now..

    ERROR: line 102: attempt to concatenate global "deviceValue" (a nil value)

    Probably device id not exists.

    [ Dodano: 2014-01-17, 13:14 ]

    Update 1.2:

    - fixed slider values preview,

    - added new parameter "wakeTime"

    - few others.

    Script:

    Please login or register to see this link.

    First post:

    Please login or register to see this link.

    • 0
    Posted

    Hello Rafal.m,

    Thank you for the great script, love the way it works.

    I have one question..

    I am trying to make the following scene:

    Please login or register to see this image.

    When the Vision1 detects motion the lights in the hall goes on for 1 minute. When you arrive at the first floor the second (Vision2) detects movement. When there is no movement for 6 minutes the lights go off. If not, the lights stay on. When you go to the second floor the Vision3 detects motion. When there is no motion for 3 minutes, the light go off.

    -----------------------

    Now with your script the scene works on Vision1 and Vision2 but when you go to the second floor the time stays on the 6 minutes and counting down.

    Is there a possibility to adjust the timers in a negative way?

    Why? ill tell you :)

    - wake up on the second floor

    - go to the ground floor

    The lights should go off in 1 minute, to save power

    - Going to bed but i am holding up on the first floor (bathroom, washing machine)

    - the lights stay on for 6 minutes if no motion is detected, otherwise it will set the timer to + 6 minutes (and so on)

    - after spending time on the first floor i go to bed on the second floor

    - Lights go of after 3 minutes

    In short, the last breached Vision has to overrule the timer.

    Is it possible or am i asking to much :-?

    • 0
  • Inquirer
  • Posted

    I have one question..

    So, if I understand, you want to set timer (slider) for lower value (time) in some cases?

    • 0
    Posted

    Yes, indeed.

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

    • 0
  • Inquirer
  • Posted

    I will check today, what I can do with script.

    OK, new version

    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 1.3:

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

    For update, go to first post and grab script from the link.

    • 0
    Posted

    I will check today, what I can do with script.

    OK, new version

    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 1.3:

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

    For update, go to first post and grab script from the link.

    You are the man, great work

    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

    [ Added: 2014-02-22, 14:20 ]

    Hi rafal.m, the light automation is working great with the negative values but after some weeks of using this i have a question;

    The manual switch doesn't override the [-] values. Is there a way to change this?

    • 0
    Posted

    Hi

    Many thanks for autolights. Has been working well.

    Recently after update to 3.583 had some issues with non-responsive HC2

    Fibaro Support suggests that autolights is using a lot of hardware resources?

    Do have 6-7 device ids controlled via autolights.

    And one or more regularly counting down at same time.

    Has anyone seen this? Would expect it to use a bit as most active device and controlling a number of devices. But maxing out and causing issues?

    How many Ids is everyone running? Regularly? Or one once in a while

    Very reluctant to disable as effectively the single most important aspect of my home automation currently. No point turning lights on unless they automatically turn off!

    Thanks

    Glenn

    • 0
    Posted

    Hi

    I have 13 items running on it at the moment including a bathroom and a toilet fan. Cannot see a problem at the moment.

    On 3.583

    Brian

    • 0
    Posted

    Thanks

    Figured it was unlikely the problem.

    The way I'm going with support will have to delete everything - and then have a working system not controlled anything! Not much use that would be.

    Glenn

    • 0
  • Inquirer
  • Posted

    The manual switch doesn't override the [-] values. Is there a way to change this?

    New version (1.4) ready! Check if that's working.

    • 0
    Posted

    The manual switch doesn't override the [-] values. Is there a way to change this?

    New version (1.4) ready! Check if that's working.

    Works perfect!

    Great work

    Please login or register to see this image.

    /emoticons/default_icon_mrgreen.gif" alt=":mrgreen:" />

    • 0
    Posted

    Hi,

    is it possible, that every Device which is connected to an Remote Gateway doesn`t work?

    I have 2 HC2 (because of two Buildings directly side by side, but one Gateway doesn`t work) The Script works fine with every Device which is paired wit that HC2 on that the Script runs. And by The Way "Great Job!!"

    • 0
  • Inquirer
  • Posted
    Hi,

    is it possible, that every Device which is connected to an Remote Gateway doesn`t work?

    I have 2 HC2 (because of two Buildings directly side by side, but one Gateway doesn`t work) The Script works fine with every Device which is paired wit that HC2 on that the Script runs. And by The Way "Great Job!!"

    Unfortunately, at this time the script works only with the physical switches. To change this, I need a little work on it.

    • 0
    Posted

    That would be very nice! Thank you very much!!!

    Greetings from Germany

    [ Added: 2014-04-21, 11:55 ]

    Hi!

    After some testing I desperate here soon. I want to use the timer that I have one Slider per room and not for each device. I have in a room up to 4 circles of light and if you take a single slider, the virtual device is pretty long and confusing. How can I put more than one device in one Slider?

    I have tested

    {

    "action": "autoOff",

    "deviceId": 114, 115, 167,

    "defaultTime": 500

    }

    and also

    {

    "action": "autoOff",

    "deviceId": 114,

    "deviceId": 115,

    "deviceId": 167,

    "defaultTime": 500

    }

    and also

    {

    "action": "autoOff",

    "deviceId": 114; 115; 167,

    "defaultTime": 500

    }

    • 0
    Posted

    I´m testing your timer slider and i like it, but i cant get it to work like you say it will.

    Every move or opening the door event will restart counter to 3 or 5 minutes

    That will not work for me, i using an api string that starts the timer, but when the string sends again the timer will not restart at 240 sek in my case, the timer Counts down to zero and put out the light before it restarts and lights up again,

    my api string looks like this.

    Please login or register to see this code.

    Maby i cant use the api string to get i to work as it should.

    The reason i use the api string to this is because its a nexa pir that i use, so my system for nexa send this api string to HC and lights up a Fibaro dimmer in the bathroom

    Edit: Now it works, I had to send the api sting with -240 to make the timer to start over again. Thanks Bamsefar.

    • 0
  • Inquirer
  • Posted

    After some testing I desperate here soon. I want to use the timer that I have one Slider per room and not for each device. I have in a room up to 4 circles of light and if you take a single slider, the virtual device is pretty long and confusing. How can I put more than one device in one Slider?

    I have tested

    {

    "action": "autoOff",

    "deviceId": 114, 115, 167,

    "defaultTime": 500

    }

    and also

    {

    "action": "autoOff",

    "deviceId": 114,

    "deviceId": 115,

    "deviceId": 167,

    "defaultTime": 500

    }

    and also

    {

    "action": "autoOff",

    "deviceId": 114; 115; 167,

    "defaultTime": 500

    }

    Right now the only way is use extra switch and make association with rest lights in room.

    I have to rewrite script to working in your way, of course it's posiible. Right now I'm working on other project, that take my all time. Sorry for that, but I can't do that now

    Please login or register to see this image.

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

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