I want to know when a binary sensor was last changed (from on to off or vice versa).
I tried finding information on here but could not find anything that seem to work?
last_changed is a property of the entity’s State Object. That’s why you can’t reference its value using states() or state_attr(). In addition, the states() function only accepts an entity_id (and nothing else).