Force set a device's state without necessarily performing the action


I have a which I use to control my old ceiling fans via Home Assistant, which works very well. The issue is that if you control the fan outside of the HomeAssistant environment, HomeAssistant’s device state gets out of sync.

I know the best solution is 2 different switches, but I have an old house and do not want to spend the $$$ to rewire the house in this way.

So I have started on a blueprint where I am trying to set the stat of my Ceiling Fan’s Light to “off” if an illuminance sensor reports a set low value, and sets it to “on” if an illuminance sensor reports a high value. In an attempt to try to keep things in sync.

Here is a gist I have started, but know is not functional. I do not know how to make this entity have a state without forcing it to actually perform the action associated with that state. I also am not sure if I can do both the “on” and “off” with one blueprint (trigger 2 different conditions based on device’s value)

You can use choose: depending on the conditions it will turn off/on your device with one automation.