I have a Shelly device connected to HA over MQTT, it sends to the following topic every so often shellies/shelly1/input/0 a payload of either 1 or 0 depending on whether the switch state is on or off.
I’d like to set up an automation that runs ONLY if the payload has changed since the message was last sent. I’m struggling with how to achieve this.
and an automation, that triggers only on defined transitions:
trigger:
- platform: state
entity_id: binary_sensor.shelly_1
from: 'on'
to: 'off'
- platform: state
entity_id: binary_sensor.shelly_1
from: 'off'
to: 'on
The action simply posts a notification reporting what was received. Obviously, it would be replaced by whatever it is that you want the automation to do.