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

Modifying device parameter in script


Question

Posted (edited)

Dear all,

Is it possible to modify a device parameter from a script? Essentially I would like to modify the default dimming level according to the time of day. Hence I would like to modify parameter 19 (force dimming level) of a Fibaro dimmer (e.g. set the value to 99 during daytime and 50 during nighttime). However, I cannot find such a function in LUA. Is this possible? 

 

If it is not possible directly in LUA: I am flexible concerning the platform/programming language. I have at my disposal: Rasp Pi (running homebridge), Synology, HC2.

What would be the best way to approach this?

 

Thanks! 

 

(I am a newbie in home automation, excuse my ignorance)

Edited by 3JL

6 answers to this question

Recommended Posts

  • 0
Posted

Isn't it easier to have LUA script triggered by motion sensor that will turn on lights at different dimming levels depending on time of day or different situations than to do all this stuff with API, Rasp PI, Synology or what so ever?

 

I can see use of that if you still want to turn on lights manually with switch and not with motion sensor, but dimmer 2 has ability for scene activation so this ability can be used to turn on light and also run script that can check time of day and adjust dimming level of the light. There is more about scene activation with dimmer 2 here:

 

Please login or register to see this link.

 

look under Advanced parameters -> 28. Scene Activation functionality

 

  • 0
  • Inquirer
  • Posted

    Thanks Sankotronic!

    Don't you then get that the dim level is only adjusted after the light is on? (Hence, there is a delay between turning on and defining the right dim level?)

    • 0
    Posted
    21 minutes ago, 3JL said:

    Thanks Sankotronic!

    Don't you then get that the dim level is only adjusted after the light is on? (Hence, there is a delay between turning on and defining the right dim level?)

     

    Well, that entirely depends on the way it is done. Dimmer 2 will turn on light at the last dimming level that was previously set so if it happens that it changes level after turning on then this will happen only two times in a day. First time when it is turned on for daylight time and first time when it is turned on for night time. 

     

    Here is that simple code that will adjust dimming level to the day or night time dimming level when momentary switch S1 is pressed once. It will also change dimming level if light is turned on and value of global variable Darkness is changed (0 - for day time, 1 - for night time):

    Please login or register to see this code.

    If you have momentary switch S2 connected to the dimmer then this code will turn on light at desired brightness level:

    Please login or register to see this code.

    Code will work if you use momentary (push) switch connected either to S1 or S2 terminal. 398 is ID of my dimmer 2 module and you have to replace with ID of your dimmer module.

     

    If you have toggle switch connected to dimmer 2 then above code will not work and has to be change slightly.

     

    • 0
    Posted
    53 minutes ago, Sankotronic said:

    %% properties 398 sceneActivation

     

    I would like to trigger this for all my Dimmer2's. Do I therefore need 1 scene per Dimmer 2 or can do something like 1,2,3,4,5 sceneActivation and then change the code of the scene off course?

    • 0
  • Inquirer
  • Posted

    Thanks @Sankotronic! That helps;  I will start working on this tonight :)

    The next step would be to slowly dim the lights over the evening; would that fundamentally change your approach?

     

    BTW I have never understood the purpose of the header. Is that a necessity or more a best practice?

     

     

    Please login or register to see this code.

     

    • 0
    Posted
    31 minutes ago, 3JL said:

    Thanks @Sankotronic! That helps;  I will start working on this tonight :)

    The next step would be to slowly dim the lights over the evening; would that fundamentally change your approach?

     

    BTW I have never understood the purpose of the header. Is that a necessity or more a best practice?

     

    Please login or register to see this code.

     

     

    @3JL,

     

    Scene header is used to declare device, event and/or global variable which status change will start this scene. For example if you add global variable Darkness to the scene header under the %% globals:

    Please login or register to see this code.

    Then whenever Darkness value is changed this scene will be started to preform some action. Let's say that Darkness can have two values: 0 - that represents day time (time from sunrise until sunset) and 1 - night time (time from sunset until sunrise). Whenever Darkness value is changed from 0 to 1 or from 1 to 0 this scene will be started. This feature we can use then to rise or lower blinds or turn on or off lights like in this small example:

    Please login or register to see this code.

    This is very simple example and this scene if it is run manually will also preform action same as if triggered by global variable Darkness. Thanks to LUA this simple scene can be extended so that for example blinds are not raised if we are not at home or if we are still sleeping etc, etc.

     

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