Use state in automation ! Help


I would like to use that sensor state as data in a media_player.volume_set service.
`- id: ‘1594031322796’
alias: Set TV Volume
description: lol

  • device_id: 94aa1db8002e4b18a88c654917a1c0c2
    discovery_id: 0xec1bbdfffe2ad0fc action_rotate_stop
    domain: mqtt
    platform: device
    subtype: rotate_stop
    type: action
    condition: []
  • data_template:
    volume_level: “{{ states(‘sensor.audio_lol’) | float}}”
    entity_id: media_player.teve
    service: media_player.volume_set`

But it’s not working… Does someone has an idea ? Thanks !

Please format your YAML properly, otherwise we can’t help you. Use three backticks (```) above and below the YAML.