Hi, apologies if this has been answered previously, but the topic is really hard to search for.
Is it possible to trigger an automation based on a device changing state, but ONLY when that state change was not initiated by HA?
For example, let’s say I have a switch that can be controlled via MQTT messages from HA, but ALSO from an external source. When HA receives a state change message from the switch, is it possible to detect that the change was commanded by the external source and not by HA?