set switch state by parameter dzvents

Moderator: leecollings

Post Reply
kispalsz
Posts: 31
Joined: Friday 13 October 2017 19:56
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

set switch state by parameter dzvents

Post by kispalsz »

Hi!

How can I change my switch state by parameter?

I have a swhitch device, but cannot change there state.

This work:

Text device: domoticz.devices("Time stamp error history entry 1").updateText(item.json["6800"].value)
Temperature device: domoticz.devices('Boiler temp actual value').updateTemperature(tonumber(item.json["8310"].value))
Counter device: domoticz.devices("Fan speed").updateCounter(item.json["8323"].value)

domotic.devices("XYZ) .updateText .updateTemperature and .updateCounter are working. But what is doing with virtualswitch ?

I found only .switchOn and switchOff and .toggleSwitch function. But how can I set my switch state by parameter? ( without if function)

Thanks.
willemd
Posts: 661
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: set switch state by parameter dzvents

Post by willemd »

I have not tried it but the dzvents wiki page states:

Code: Select all

There are many switch-like devices. Not all methods are applicable for all switch-like devices. You can always use the generic setState(newState) method.
kispalsz
Posts: 31
Joined: Friday 13 October 2017 19:56
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: set switch state by parameter dzvents

Post by kispalsz »

Hi!

Thanks! This was a solution.
User avatar
waltervl
Posts: 5907
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: set switch state by parameter dzvents

Post by waltervl »

What subtype of virtual switch are you using? There are many.https://www.domoticz.com/wiki/Dummy_for ... h_Subtypes

Each switch type has specific dzvents switch options next to the general ones.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest