New equals old

If I have a listen state like:

self.listen_state(self.sensorChange, "device_tracker.frank_samsung")

Should I ever expect to see old and new wit the same value in sensorChange? I am seeing it but I’m trying to understand why.

Should I just add if (old==new): return ?

even if old == new there can be something changed.
an entity also has attributes, and with a change there the listen_state is also triggered.
so yeah if you dont want anything to happen, then add a check in the first line from the callback.

1 Like

Or … just add the values you are looking for on the listen_state line … old=“xxx”, new=“yyy”

2 Likes