Only run an automation if another one ran before it (nvidia shield idling issue)

Hi there, thanks for your time.

I’m trying to reduce the amount of controllers used by automating the home theater through the nvidia shield controller. I’ve managed to properly power on the shield->AVR->projector->projector screen (down) and return everything to their off state when the shield is off, but I’m left with an inconvenience when the shield idles for a bit: the automation runs when the shield leaves the idle state (only way the automation triggers when the shield is active - “on” state doesn’t work since the shield appears to idle in a sleepy state instead of powering off) and as a result the projector screen lowers past the “tv” set.

I’ve been trying to create a condition where the automation runs only if the “off” automation has run first with no luck.
I hope I’m making sense - any ideas on how I might solve this / make it simpler are much appreciated!

Automations:

alias: Projector screen Down when Shield On - Projector On
description: ''
trigger:
  - platform: state
    entity_id:
      - media_player.living_room_nvidia_shield
    to: 'On'
    for:
      hours: 0
      minutes: 0
      seconds: 0
  - platform: device
    device_id: redacted
    domain: media_player
    entity_id: media_player.living_room_nvidia_shield
    type: turned_on
  - platform: device
    device_id: redacted
    domain: media_player
    entity_id: media_player.living_room_nvidia_shield
    type: idle
condition: []
action:
  - service: remote.send_command
    data:
      device: avr
      command: 'On'
    target:
      device_id: redacted
  - service: remote.send_command
    data:
      device: Projector
      command: 'On'
    target:
      device_id: redacted
  - service: remote.send_command
    data:
      device: projector_screen
      command: Down
    target:
      device_id: redacted
  - delay:
      hours: 0
      minutes: 0
      seconds: 26
      milliseconds: 700
  - service: remote.send_command
    data:
      device: projector_screen
      command: Stop
    target:
      device_id: redacted
mode: single

To turn things off:

alias: Projector screen Up when Shield off - Projector Off
description: ''
trigger:
  - platform: state
    entity_id: media_player.living_room_nvidia_shield
    to: 'off'
condition: []
action:
  - service: remote.send_command
    data:
      device: projector_screen
      command: Up
    target:
      device_id: redacted
  - delay:
      hours: 0
      minutes: 0
      seconds: 10
      milliseconds: 0
  - service: remote.send_command
    data:
      device: Projector
      command: 'Off'
      num_repeats: 2
      delay_secs: 1
    target:
      device_id: redacted
mode: single

I don’t see any conditions in your automation, just triggers.

Some example above that hopefully help, you could use a condition instead or as well as, difficult to be exact without knowing what states the media player has.

That is correct, the conditions I attempted weren’t working so I opted to remove them in hopes someone would come up with something easier. Didn’t think of it earlier but just using “from off to idle” in Trigger appears to work so far :slight_smile:

1 Like

Thanks for pointing out the capital O, totally missed that. Still wasn’t working as “on” doesn’t appear as an available state while looking through the device logbook, that helped a bunch as the nvidia shield states appear to be “off”, “idle”, “playing” and “standby”. Turning the device on manually gets the shield directly into the idle state.
Reduced the trigger down to “from off to idle” and it seems like its working- if not I’ll give a try to the not_from conditions you suggested.

Thanks, your comment helped me brainstorm :slight_smile:

1 Like

Can you use something like an input_boolean to track its state transitions, e.g. to ‘on’ set in boolean. To off set in boolean. That way you can ignore the idle states?

I have blinds that are 433MHz (so are unknown all the time), and I track their state that way, when event occurs (open/close/favourite), I record the open/close/favourite events in an input_select.

Thanks for the reply.

Haven’t got my head around booleans yet so I’d have to look into that. “on” doesn’t appear to be a valid state for my media player (unless it triggers only when the device is manually plugged in).
From off to idle” seems to do the job for now.