Please help a noob with MQTT -> HA

I try to set the volume of my Denon AVR via an MQTT Topic, but this automation won’t work. :confused:

alias: Denon-MQTT-Volume
description: set denon Volume from MQTT topic
trigger:
  - platform: mqtt
    topic: Entertain/wz/denon.main/cmnd/volume
condition: []
action:
  - service: media_player.volume_set
    data:
      volume_level:
        {{trigger.payload}}
    target:
      device_id: 5bccb3480ffd083531a571bb75c46108
mode: single

what am i doing wrong? :worried:

Assuming the MQTT topic is correct and, most importantly, the received payload is a numeric value between 0 and 1 (not between 0 and 100) then the sole error is a minor one: add a line-continuation character (>) after value_template.

    data:
      volume_level: >
        {{trigger.payload}}

If the received value is between 0 and 100 then you should also do this:

    data:
      volume_level: >
        {{ (trigger.payload | float(0) / 100) | round(3) }}
1 Like

thank you.
works perfect.

1 Like