How to find out which states a certain sensor has?

Hi guys,
I have a sensor (Unify) that detects if a certain WifiDevice is currently logged in my WiFi or not.
I want to do a simple automation that when a device is absence and comes back to the Wifi I get a push notification.
But I’m always searching where all the potential states of such a sensor are listed.
Is the state “On” or “Off” ? Is it “active / inactive” or “true / false” ?

How do I know that? Where can I found that states?

This is my automation so far. I just want to get a notification, when a device joins Wifi. But it doesnt work.

alias: Presence Detection
description: ''
trigger:
  - platform: state
    entity_id:
      - device_tracker.peter_pixel_6
    from: away
    to: home
condition: []
action:
  - service: notify.mobile_app_pixel_6
    data:
      message: He is home
      title: Presence
mode: single

https://www.home-assistant.io/integrations/device_tracker explains the states of the device_tracker entities. For everything else you can look in Developer Tools → States and see what the current state is.

For historical states you’d have to do a SQL query on the database, something like:

SELECT DISTINCT state FROM states WHERE entity_id = 'device_tracker.peter_pixel_6';

You sir, are a machine.

There is a feature request here that you might like to vote for:

https://community.home-assistant.io/t/add-a-selectable-option-to-display-either-true-state-or-the-translated-front-end-state-in-the-entity-history/448521/1

2 Likes