Automation not triggering sub-automation as expected

Fighting with this for a couple days now, hopefully someone can quickly point out my mistake …

I have a ‘stateless’ projector control - power toggle. Obviously I don’t want things turning off when they’re already on and the desired state is on, etc.

I thought, or read something somewhere (don’t recall, it’s been so much time and I’ve read so many things) that the best way to achieve that would be to check the state via either the media player integraion (which can’t control power), or the homekit integration (which also can’t control power), and then take action only if it is in the wrong state.

I can’t apply this logic to my ‘top level’ automation though as there are other things that I do want to fire every time, as they’re explicit and/or I don’t have the means of checking their current state - i.e. if the projector screen is already ‘down’, sending a ‘down’ command isn’t going to break anything - so I send it every time, which is a million times easier than trying to track the state of a ‘dumb’ device.

So anyway, I have the top level automation checking for any time my Harmony Hub switches to one of my ‘on projector’ activities -

alias: Start activity on Projector
description: ""
triggers:
  - trigger: state
    entity_id:
      - select.harmony_hub_activities
    to: Fibe on Projector
  - trigger: state
    entity_id:
      - select.harmony_hub_activities
    to: Shield on Projector
conditions: []
actions:
  - action: webostv.command
    metadata: {}
    data:
      entity_id: media_player.lg_webos_tv_oled77cxpua
      command: system/turnOff
  - action: remote.send_command
    metadata: {}
    data:
      num_repeats: 25
      delay_secs: 0.4
      hold_secs: 0
      device: elunevision-screen
      command: screen-down
    target:
      device_id: e76896659d07d11e411bc04d122a463f
  - action: automation.trigger
    metadata: {}
    data:
      skip_condition: false
    target:
      entity_id: automation.projector_on
mode: single

and it is then calling the sub-automation ‘projector_on’ where the “check if it is already on” condition lives -

alias: projector-on
description: ""
triggers: []
conditions:
  - condition: device
    device_id: dacaeb4f2ff12afe156ac2a254408044
    domain: media_player
    entity_id: 4f593f3f36eec4b7e8d1eea77ebfa460
    type: is_off
actions:
  - action: remote.send_command
    metadata: {}
    data:
      num_repeats: 1
      delay_secs: 0.4
      hold_secs: 0
      device: lg-tv
      command: power-toggle
    target:
      device_id: e76896659d07d11e411bc04d122a463f
mode: single

the ‘top level’ automation is firing, but the ‘lower level’ one is not.

I know there is the ‘ignore condition’ toggle on the ‘top level’ automation - but that reads as though “we will do the action of this automation, regardless of the condition checks you have set up in it”, i.e. “even if the projector is already on, we’ll send an on, and end up turning it off” … sooooo, I’m stumped. Please advise <3

Does the second automation work without the condition? Does the condition work at all?

In the visual automation editor you can test your conditions from the … menu next to the condition. If it does not evaluate as true when the projector is off, well your condition is broken.

Device conditions/actions/triggers are crap, they are hardcoded to unique ids and are pretty much unreadable. Regardless of whether the problem is the condition I would still replace it with a state condition.

Apologies, that would have been worth mentioning -

Yes, the ‘sub-automation’ works entirely as expected when called directly.

I’ll investigate the available states … I believe they were limited compared to the device directly though and did not include the power state which is why I ended up going the device route. I’ll recheck though.

So what exactly is it that your condition is supposed to check the state off? As already mentioned, impossible to tell with device conditions.

If it is possible with a device condition, it seems very unlikely to me that it wouldn’t also be possible with a state condition. In that case it seems more likely that the visual device condition builder is wrong about whatever your device is reporting its on/off state correctly or at all…

These are ALL the available state items in the left two columns … that is all that gets exposed by HomeKit, and the generic ‘mediaplayer’ entries. There is NO direct support for this device in HA right now, and every time someone comes up with something, the vendor changes stuff and breaks it.

On the right is everything that is exposed from ‘the device’ as conditions :-/

As you can see, there is a lot more there, including ‘is on’ and ‘is off’, which yeah, I would have expected to be able to find as a ‘state’ from something, especially considering it’s displayed right there in the UI, with perfect and instant accuracy -

image

I’m just seeing now for the first time though it has gone ‘unavailable’, I guess when the projector enters some low power sleep mode after being off for a while. Maybe I’ll add ‘or unavailable’ to the conditions and see if that helps … ‘off’ isn’t working either though and follows the same format as above, so I don’t have high hopes.