Set device state directly

Is it possible to set a device's state directly?
I have a three way switch controlling my basement lights. The wiring is old enough that I can't just install zwave switches, I have instead a thirdreality device that physically moves the switch but the issue is the state of that switch is not reliable (3-wave switch). I have a light sensor so ideally I would use the light sensor to set the state of a virtual switch directly then when the virtual switch is turned on/off it just toggles the actual switch.
Unfortunately I can't seem to find a way to do that.

Could this be a job for the built-in Mirror app? With your virtual switch as the mirrored device and the physical switch as target?

You need to keep track of the light state with the illuminance sensor. You could keep track of it with a bool hub variable.

Make a rule that when the illuminance changes, you evaluate if the light is on or off.
if lux > light on value, then set lightOnVariable to true
else set lightOnVariable to false

Then have a rule for your virtual switch changing.

if virtualSwitch turns on, and lightOnVariable is false, toggle the switch
if virtualSwitch turn off, and lightOnVariable is true, toggle the switch

When the light turns on or off, the illuminance rule will automatically set the variable accordingly to true or false to keep track of state.

1 Like

Do the third reality switches report their individual condition/position reliably? If so, you have two switches. They could be set up one of two ways:

A) Both Switches in same condition (up or down), Light is on, and
Switches not in same condition (up or down), Light is off, or

B) Both Switches in same condition (up or down), Light is off, and
Switches not in same condition (up or down), Light is on

You could set up logic based on that

Lack of a neutral conductor in the workbox?

FWIW, there are zigbee, z-wave, and Lutron dimmers that can be installed without a neutral. They work by leaking current to the load.

Thanks everyone for your suggestions on how to handle this issue