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

Certain light value upon switch


Question

Posted

I have another LUA-noob question that I can't figure out.

At night I would like to have the lights in the staircase turn on in a much more dimmed fashion. Therefor the script should check what time it is and if it's between sunset and sunrise, it should turn on with a much lower value than normal. So far this is working.

But of course I should be able to adjust the value. So once the light is on, you will still be able to adjust it without the dimmer being adjusted by this rule, until the light is switched off.

But that is where it goes wrong; the light doesn't switch off anymore. Which makes sense; the scene is triggered.

Since I would like to show I've put some effort in getting it done, I'm pasting my code here. How can I adjust it so that it once the light is turned off, it's not switched on again?

Please login or register to see this code.

5 answers to this question

Recommended Posts

  • 0
Posted

Hi hvb83,

In your code, lichtuit is being tested (line 17) before it is created and set (line 20).

I'm not exactly sure what you are trying to achieve but this, currently, is what your scene does:


  • - When the light level (value of the "value" property) of device 25 changes, the scene starts.
    - Then it makes sure it is not already running - if it is, it stops
    - It checks the current light level
    - It gets current time + 1 minute - as a string (for example "08:59") - it does this twice
    - The if statement tries to compare the string your just created with the string of sun set. It tries to compare these two strings with a > (which won't work) and also compares lichtuit which does not exist yet.
    - Assuming the if was true, it then sets the value of the light
    - It then gets the value of the light (which should be the same as what you just set it to, but may not be because you need a sleep in there to give time for zwave to send the command).

I suggest you try turning on sceneActivation (in your dimmer's advanced settings, scroll all the way to the bottom and turn on parameter 41). Then change the word "value" in your trigger block to "sceneActivation". This will trigger your scene only when the switch is used on the dimmer - not when the value of the light changes.

Then you need to fix the comparison of the hour and sunset. But you don't need to worry about the scene running every time you change your light value.

Happy Automating!

Adam Bewsher

  • 0
  • Inquirer
  • Posted

    Ah thanks Adam, that helps a lot! Going to try it tonight, thank you so far!

    • 0
    Posted

    You're welcome.

    Let us know how it goes and post your final scene.

    Happy Automating,

    Adam

    • 0
  • Inquirer
  • Posted

    What I've done for now is the following:

    Please login or register to see this code.

    Had to use a global to make sure it would work. I'm sure the code isn't as clean as the professionals would do it, but for now it seems to work. Now I only got to make sure that it works between sunrise and sunset again, took that out for testing purposes.

    • 0
    Posted

    Hmm... I have a working script which works based on the value rather than scene activation - I'll post it once I get home... But basically, what that does, is to register the switch change and then set the brightness (this happens flicker free) to 30% of both our bedlamps. Then when we want to go to sleep, I turn off one, and both dims out over 2-3 minutes. Then if you turn it on again during the night, it will only turn on to 15%. Once day mode is engaged, it will switch on to full brightness (or whatever preset I choose).

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