Consistent values for sensors

Not sure whether this is something that could be improved or it’s me not understanding, but: i have a motion sensor. When i look in the logbook, the device is reported as “detected motion” and “Cleared (no motion detected)”. When i look at the entity card, statussess are reported as either “Clear” or “Detected”. When i lookup the sensor in the Developer section it’s status is “on” or “off”. When creating an automation, i wonder what status i need to check. Should i test for status “detected motion”, “Detected” or “on”? My point: could these statussess be better aligned, so one knows what to test for?

You should always test for on or off if it is a binary sensor. This is what the underlying state can be. detected motion or Detected is to better give a visual presentation and make it easier for the user when using the app or webpage to determine what the sensor reports. And for the logbook it is probably to give a even more detailed description for what the state was/is.

on or off is much easier to handle when programing or making automations, where detected motion is problematic at best but a much better description of what actually happened.

1 Like

Thank you for your reply. But i wonder whether this is clear for people without a developers background.

That is a good point. Though it would be impossible to do it in a none developer oriented way as Automations are basically programing so we will always end up there when having to decide what to call things. I always have two tabs open, one with the developer tool tab and one with automation i am creating.

2 Likes

Don’t forget to vote for your own suggestion

Yeah, it’s come up a few times. The frontend translates the actual state to something human friendly, which throws a lot of people. It’s not at all obvious that Away is actually not_home or that Occupied is actually on.

I agree that it should ideally provide some way of seeing the actual state too.

2 Likes