dimmer
The dimmer block provides additional functions for room lighting control. It supports smooth dimming and brightening of the light using a local button, a motion sensor, or other parts of the project.
Configuration parameters
| Parameter name | Value |
|---|---|
Button time ON [s] (btn_time) |
Numeric field that defines the time in seconds for which the light stays on after a short press of the local button (input tag1). The allowed range is from 0 to 43200 seconds (that is, 12 hours). Setting the value to zero causes the light to turn on permanently. |
Button value [%] (btn_value) |
Numeric field that defines the brightness level in percent to which the light is set after a short press of the local button (input tag1). The allowed range is from 1 to 100 percent. |
Button transition time [s] (btn_transition_time) |
Numeric field that defines the time in seconds over which the transition to the brightness level set by the local button (input tag1) is performed. The minimum value is 0 seconds, and the maximum value is 600 seconds (that is, 10 minutes). Setting the value to zero causes the brightness to change immediately. |
Motion time ON [s] (motion_time) |
Numeric field that defines the time in seconds for which the light stays on after motion is no longer detected, based on the motion sensor input (input tag2). The allowed range is from 0 to 43200 seconds (that is, 12 hours). Setting the value to zero causes the light to turn on permanently. |
Motion value [%] (motion_value) |
Numeric field that defines the brightness level in percent to which the light is set after motion is detected (input tag2). The allowed range is from 1 to 100 percent. |
Motion transition time [s] (motion_transition_time) |
Numeric field that defines the time in seconds over which the transition to the brightness level set by the motion sensor (input tag2) is performed. The minimum value is 0 seconds, and the maximum value is 600 seconds (that is, 10 minutes). Setting the value to zero causes the brightness to change immediately. |
Remember last value (remember_last_value) |
Enabling this option causes the dimmer to keep the last brightness value set for the button, for example after holding the local button for a longer time (input tag1). When the light is turned on again, for example by a short press of the local button or by sending a numeric value to the block input, the light is set to that remembered value. If this option is disabled, the light is always set to the value defined by the Button value [%] parameter. |
Default value [%] (default_value) |
Numeric field that defines the brightness level in percent to which the dimmer light is set after the project starts, unless the block restores another value. |
Repeat command periodically (repeat_command) |
Enabling this option causes the dimmer block to periodically send brightness-setting requests to the connected device, for example a dimmer module. The requests are sent every 5 minutes. This option is useful when the device may lose the configured brightness value, for example after a power loss, and needs a periodic reminder of the requested value. |
Restore state after power loss (persistent_state) |
Enabling this option makes the block try to restore the last persisted dimmer state after the system starts again. The state is not persisted immediately, but about 10 minutes after the last change. If a restart or power loss happens earlier, an older state may be restored. |
Input handling
The dimmer block accepts integers in the range from 0 to 100 when they are sent directly to the block input and not through the tag block. This value defines the requested light brightness in percent that should be set by the dimmer. If the provided value is outside this range or is not an integer, it is ignored. If the value is positive (from 1 to 100), the light is turned on to that brightness level for the time defined by the Button time ON [s] configuration parameter. Additionally, if the Remember last value option is enabled, this value is remembered as the last set brightness value. If the provided value is 0, the light is turned off.
Sending the set command from the command block to the block input sets the light immediately to the brightness value for the local button defined by the Button value [%] configuration parameter for an indefinite time.
Sending the reset command from the command block to the block input turns the light off.
Additionally, the dimmer block supports the following inputs marked using the tag block:
| Input number and name | Description |
|---|---|
| tag1: Local button | Sending the value true to the input on the tag1 line informs the block that the local button has been pressed, while sending false informs it that the button has been released. A short press (for less than 1 second) turns the light off or turns it on for the time defined by the Button time ON [s] configuration parameter and to the brightness defined by the Button value [%] parameter. A long press (for 1 second or longer) starts brightening or dimming the light in steps of +/-5% in the range from 5% to 100% and back, until the button is released or a limit value is reached. NOTE: While the button is pressed, this input reacts only to releasing it. All other values sent to the block input during that time are ignored. |
| tag2: Motion sensor | Sending the value true to the input on the tag2 line informs the block that motion has been detected by the motion sensor, while sending false informs it that motion is no longer present. After motion is detected, the light is turned on to the brightness defined by the Motion value [%] configuration parameter. After motion disappears, the light remains on for the time defined by the Motion time ON [s] parameter and is then turned off. |
| tag3: Change of the Button value [%] parameter | Sending an integer to the input on the tag3 line temporarily changes the value defined by the Button value [%] configuration parameter to the value sent to this input. This value remains active until the project is restarted, another value is sent to this input, or the brightness for the local button is changed while the Remember last value option is enabled. |
| tag4: Change of the Motion value [%] parameter | Sending an integer to the input on the tag4 line temporarily changes the value defined by the Motion value [%] configuration parameter to the value sent to this input. This value remains active until the project is restarted or another value is sent to this input. |
| tag5: Change of the Button time ON [s] parameter | Sending an integer in the range from 0 to 43200 to the input on the tag5 line temporarily changes the value defined by the Button time ON [s] configuration parameter to the value sent to this input. This value remains active until the project is restarted or another value is sent to this input. |
| tag6: Change of the Motion time ON [s] parameter | Sending an integer in the range from 0 to 43200 to the input on the tag6 line temporarily changes the value defined by the Motion time ON [s] configuration parameter to the value sent to this input. This value remains active until the project is restarted or another value is sent to this input. |
| tag7: Change of the Button transition time [s] parameter | Sending an integer in the range from 0 to 600 to the input on the tag7 line temporarily changes the value defined by the Button transition time [s] configuration parameter to the value sent to this input. This value remains active until the project is restarted or another value is sent to this input. |
| tag8: Change of the Motion transition time [s] parameter | Sending an integer in the range from 0 to 600 to the input on the tag8 line temporarily changes the value defined by the Motion transition time [s] configuration parameter to the value sent to this input. This value remains active until the project is restarted or another value is sent to this input. |
Block outputs
The dimmer block has one output that returns the current light brightness value in percent (from 0 to 100). This value is updated every time the light brightness changes. Additionally, this value is also returned after the project is restarted, reflecting the last set light brightness (if the Restore state after power loss option is enabled). If the Repeat command periodically option is enabled, this value is also returned every 5 minutes even if the light brightness has not changed.
Errors returned by the block
The dimmer block can return the following errors:
| Error code | Error description |
|---|---|
| Invalid motion_time. | The Motion time ON [s] parameter is configured incorrectly in the block configuration. Set a value in the range from 0 to 43200 seconds. |
| Invalid motion_value. | The Motion value [%] parameter is configured incorrectly in the block configuration. Set a value in the range from 1 to 100 percent. |
| Invalid motion_transition_time. | The Motion transition time [s] parameter is configured incorrectly in the block configuration. Set a value in the range from 0 to 600 seconds. |
| Invalid btn_time. | The Button time ON [s] parameter is configured incorrectly in the block configuration. Set a value in the range from 0 to 43200 seconds. |
| Invalid btn_value. | The Button value [%] parameter is configured incorrectly in the block configuration. Set a value in the range from 1 to 100 percent. |
| Invalid btn_transition_time. | The Button transition time [s] parameter is configured incorrectly in the block configuration. Set a value in the range from 0 to 600 seconds. |
| Invalid remember_last_value. | The Remember last value parameter is configured incorrectly in the block configuration. Set a boolean value (true/false). |
| Invalid default_value. | The Default value [%] parameter is configured incorrectly in the block configuration. Set a value in the range from 0 to 100 percent. |
| Input disconnected. | The block input is disconnected. Connect the input to an appropriate data source. |
| Too many tagX connections. | The block input has too many connections on the tagX line, where X is the line number from 1 to 8. Limit the number of connections to one on each tagX line. |
| Timer error | An internal block timer error occurred. Restart the project. |