Denon avr sleep

Hello
Can anyone take a complete noob by the hand and guide him to the point where he sets the sleep time for his Denon avr.
Also this little noob doesn’t see all the values that he is used to see when he is using FHEM.
There are tons of information I get in FHEM (Input sound, sound out, etc)
Or do I expect too much?

Thanks in advance

I don’t have a Denon AVR but from reading the documents and API it should be like this:

Sleep 10 minutes:

- service: denonavr.get_command
  data:
    entity_id: media_player.your_denon_avr_here ### change this
    command: "/goform/formiPhoneAppDirect.xml?SLP010" # note the leading 0 in SLP010. The time must be 3 digits

Sleep 120 minutes:

- service: denonavr.get_command
  data:
    entity_id: media_player.your_denon_avr_here ### change this
    command: "/goform/formiPhoneAppDirect.xml?SLP120" # three digits already, no need for the leading 0

Cancel sleep timer:

- service: denonavr.get_command
  data:
    entity_id: media_player.your_denon_avr_here ### change this
    command: "/goform/formiPhoneAppDirect.xml?SLPOFF"

The valid range of time is 001 to 120 minutes.

Do you need to template this (adjust the time with an input slider), or do you just want to set a sleep time to a particular value with an automation?

It would need some trickery due to the leading zeros, and due to the “OFF” command. But it is doable.

1 Like

Thank you for the quick response
Where do you have to put that in ?

A template woud be nice.
Or an Automation to react on MQTT topic.

You can put it in the actions of an automation or the sequence of a script.

1 Like

Ok, Iwill try my best.

If you just want something you can add to Lovelace, use this input number (slider):

input_number:
  avr_sleep:
    name: AVR Sleep
    min: 0
    max: 120
    step: 1

And this automation to set the sleep when you change the input number:

- id: avr_sleep
  alias: 'AVR Sleep'
  mode: single
  trigger:
  - platform: state
    entity_id: input_number.avr_sleep
  condition:
  - "{{ trigger.from_state.state not in ['unknown', 'unavailable'] }}"
  - "{{ trigger.to_state.state not in ['unknown', 'unavailable'] }}"
  - "{{ trigger.from_state.state != trigger.to_state.state}}"
  action:
  - service: denonavr.get_command
      data:
        entity_id: media_player.your_denon_avr_here ##### CHANGE THIS #####
    command: >
      {% set sleep_time = states('input_number.avr_sleep')|int(0) %}
      {% if sleep_time == 0 %}
        /goform/formiPhoneAppDirect.xml?SLPOFF
      {% elif sleep_time < 10 %}
         /goform/formiPhoneAppDirect.xml?SLP00{{sleep_time}}
      {% elif sleep_time < 100 %}
         /goform/formiPhoneAppDirect.xml?SLP0{{sleep_time}}
      {% else %}
         /goform/formiPhoneAppDirect.xml?SLP{{sleep_time}}
      {% endif %}

Setting the input number to 0 turns off the sleep timer. Setting it to any other value starts it with that amount of minutes.

1 Like