#Template Trigger - boolean issue?

1 messages · Page 1 of 1 (latest)

spiral pollen
#

I am trying to set up an automation to control the volume of a media player pending the source, the options all present themselves in the visual editor, and manually triggering the automation does the correct volume change, but I cant get the automation to automatically trigger. I have been trying a bunch of permutations of the template trigger to capture the boolean output. the template editor responds accurately in reading true or false when the state attribute is changed, but nothing happens. The code below is what is in my yaml file, i think the issue is that it reports 'True' and not true as a boolean. how is this remedied? ive also tried putting the is_state_attr inside an if statement but it still returns a 'true' in the dev console.

Youll see both my attempts at templating and the one created with the visual editor going through the steps for state based triggers. neither works, but open to ideas on fixes?

- id: '1731701119354'
  alias: PC Vol
  description: ''
  trigger:
  - platform: template
    value_template: "{{ is_state_attr('media_player.home_theater', 'source', 'PC') }}"
  action:
  - action: media_player.volume_set
    metadata: {}
    data:
      volume_level: 0.67
    target:
      device_id: e49a35fd1eda75898ed90dde6cd566d4
  mode: single
- id: '1731698068706'
  alias: Denon Nintendo Vol
  description: ''
  trigger:
  - platform: state
    entity_id: media_player.home_theater
    attribute: source
    to: 
    - Nintendo Switch
  condition: []
  action:
  - action: media_player.volume_set
    metadata: {}
    data:
      volume_level: 0.48
    target:
      device_id: e49a35fd1eda75898ed90dde6cd566d4
  mode: single
scenic pierBOT
#

To format your text as code, enter three backticks on the first line, press Enter for a new line, paste your code, press Enter again for another new line, and lastly three more backticks.
```yaml
example: here
```
Don't forget you can edit your post rather than repeatedly posting the same thing.

neon talon
scenic pierBOT