Set value of Dimmer without turning the switch on  [Solved]

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
lnrdnl
Posts: 3
Joined: Sunday 31 March 2024 20:50
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Eindhoven Area
Contact:

Set value of Dimmer without turning the switch on

Post by lnrdnl »

Hi all,

Does anybody know if it is possible to set the level of a dimmer without switching the device on?

It seems properties of the dimmer (or switch) object in DzVents are readonly. So the only possible way to mutate them is by using the corresponding methods. So this does not work:

Code: Select all

dimmer.level = 20
This does:

Code: Select all

dimmer.setLevel(20)
dimmer.dimTo(20)
I think mutating properties with methods is very convenient and good practice. BUT! I would like to set the level without switching the device on. The reason I want to do this is because I would like to keep the "switching" logic in one script. And the "value" logic in another (based on sensor values from lux sensors).

What I tried so far is:

Code: Select all

dimmer.level = 20
--
dimmer.setLevel(20).silent()
--
dimmer.dimTo(30).afterSec(4)
dimmer.cancelQueuedCommands()
Any ideas? Thanks in advance!
User avatar
waltervl
Posts: 5903
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Set value of Dimmer without turning the switch on

Post by waltervl »

It is the same with the normal user interface. As soon as you change the dimmer setting the device will switch on. So probably no way to override.

So you have to overthink your logic and merge the scripts....
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
lnrdnl
Posts: 3
Joined: Sunday 31 March 2024 20:50
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Eindhoven Area
Contact:

Re: Set value of Dimmer without turning the switch on  [Solved]

Post by lnrdnl »

I think it is not possible. I use Zigbee2MQTT to control the actual device and even there it is not possible.

So now I solved it by storing the LevelToSet as a Domoticz variable. From the "value" logic scripts I update the Domoticz variable. And in the "switching" scripts I use

Code: Select all

dimmer.setLevel(domoticz.variables('LevelToSet').value)
Tradeoff is that I need a little more logic for switching on and off because I can't use

Code: Select all

dimmer.toggleSwitch()
anymore.
Last edited by lnrdnl on Friday 07 June 2024 22:56, edited 3 times in total.
HvdW
Posts: 617
Joined: Sunday 01 November 2015 22:45
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Twente
Contact:

Re: Set value of Dimmer without turning the switch on

Post by HvdW »

Let the value of the dimmer be read by another switch.
Bugs bug me.
User avatar
waltervl
Posts: 5903
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Set value of Dimmer without turning the switch on

Post by waltervl »

Why not just have the lux sensor trigger the lights on/off including dimmer level?
I have a script like this running without issues.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
lnrdnl
Posts: 3
Joined: Sunday 31 March 2024 20:50
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Eindhoven Area
Contact:

Re: Set value of Dimmer without turning the switch on

Post by lnrdnl »

waltervl wrote: Saturday 08 June 2024 0:31 Why not just have the lux sensor trigger the lights on/off including dimmer level?
I have a script like this running without issues.
Because for this specific light I want a motion sensor and a simple switch to trigger it (not auto switching). But I want the value based on the lux sensor. I could make a specific script for only this device, but I would rather keep the logic seperated. The way I solved it now is working perfectly. Case closed.

I now have the Lux sensor script reading and evaluating all lux sensors and switching dummies and setting the variable: LevelToSet.
Dummies:
IsLightInside
IsLightOutside
IsLightGarage

One script for handling all the motion sensors.

And one script for handling all the switches (including the dummies).
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest