Automations are very confusing (where are the names of states)

I’m trying to effect an automation on state change, but I have no idea what the states are called. Its not clear at all even where to find them. If I look at the device history, they are written out as:

Cleared (no occupancy detected)

10:45:37 PM - 10 minutes ago

Detected occupancy

10:43:48 PM - 12 minutes ago

But when I try that in the automation, get nothing. Why are they not the same, how are you meant to know?

Also the wait function here, is it seconds, mins, years?

alias: Go to Sleep
description: ''
trigger:
  - platform: state
    entity_id: binary_sensor.withings_in_bed_withings
    from: Cleared (no occupancy detected)
    to: Detected occupancy
condition: []
action:
  - type: turn_on
    device_id: 
    entity_id: switch.bedroom_fan
    domain: switch
  - device_id: 
    domain: cover
    entity_id: cover.bedroom_curtain
    type: set_position
    position: 0
  - type: turn_on
    device_id: 
    entity_id: light.bedroom_strip_1_st
    domain: light
    brightness_pct: 25
  - wait_template: ''
    continue_on_timeout: true
    timeout: '60'
  - type: turn_off
    device_id: 
    entity_id: light.bedroom_strip_1_st
    domain: light
mode: queued
max: 10

Thanks guys!

I think ive just been spoilt by WebCore lol

Developer Tools / States menu.

FYI: binary sensor states are always 'on' or 'off' despite what Lovelace shows in the frontend.

Thanks tom!

Ill see how I go with it :slight_smile:

Actually, why don’t you use the graphical automation editor in the UI? It provides very good support on device/entity and state selection.

Thanks Chris,

It does?

image

They are just text fields for me, am I missing something?

Is the wait period for all of this in seconds?

Actually, I think I may have found some good info on the Smart Home Solver site, this guys pretty good!

alias: Morning Wake Up Music
description: ''
trigger:
  - platform: state
    entity_id: calendar.wakeup
    to: 'on'
condition:
  - condition: state
    entity_id: binary_sensor.withings_in_bed_reeds_bed
    state: 'on'
action:
  - service: media_player.volume_set
    data:
      volume_level: '0.10'
    entity_id: media_player.echo_dot_master_bedroom
  - service: script.play_music_master_bedroom
    data: {}
  - delay: '00:01:00'
  - service: media_player.volume_set
    data:
      volume_level: '0.20'
    entity_id: media_player.echo_dot_master_bedroom
  - delay: '00:05:00'
  - condition: state
    entity_id: binary_sensor.withings_in_bed_reeds_bed
    state: 'on'
  - service: script.alexa_speak_wake_up
    data: {}
mode: single