NAD C368/C388 control over RS232 and ESPHome

Hello,

NAD C368/C388 control over RS232 ESPHome

I have forked branch https://github.com/machosallad/esphome-nad-uart for controlling NAD receivers.
By the idea I think more receivers/amplifiers could be controlled over RS232.

This is possible to control power, sources, volume. I could add even more settings to rename sources, but I do not think this is needed.

There is also service so you can call from HA to RS232 with your provided command.

I have created universal media player with some tweaking for volume needed. Volume from media player is sent in 0…1 range, need that to convert to dB and send to NAD receiver. Here is my config:

- platform: universal
  name: NAD C388
  children:
    - media_player.moode_upnp
  commands:
    turn_on:
      service: switch.turn_on
      target:
        entity_id: switch.nadrs232_power
    turn_off:
      service: switch.turn_off
      target:
        entity_id: switch.nadrs232_power
    volume_up:
      service: button.press
      target:
        entity_id: button.nadrs232_vol_up
    volume_down:
      service: button.press
      target:
        entity_id: button.nadrs232_vol_down
    volume_mute:
      service: switch.turn_on
      target:
        entity_id: switch.nadrs232_mute
    volume_set:
      service:  number.set_value
      data_template:
        entity_id: number.nadrs232_current_volume
        value: "{{ (volume_level * 70) - 70 }}"
    select_source:
      service: input_select.select_option
      data_template:
        entity_id: input_select.nad_source_list
        option: >
          {{ source }}
  attributes:
    is_volume_muted: switch.nadrs232_mute
    state: switch.nadrs232_power
    volume_level: input_number.c388_volume_number
    source: input_select.nad_source_list
    source_list: input_select.nad_source_list|options
  device_class: receiver
  unique_id: c388mediaplayer

Additional helper for source_list is needed.

For volume control additional template sensor and automation is needed:
Template sensor template:

{{ (states('number.nadrs232_current_volume') | float + 70) / 70 }}

Automation:

alias: C388 Media Player update volume slider
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.c388_volume_level
condition:
  - condition: not
    conditions:
      - condition: or
        conditions:
          - condition: state
            entity_id: sensor.c388_volume_level
            state: unavailable
          - condition: state
            entity_id: sensor.c388_volume_level
            state: unknown
action:
  - service: input_number.set_value
    target:
      entity_id: input_number.c388_volume_number
    data_template:
      value: "{{ states('sensor.c388_volume_level') | float }}"
mode: single

I hope this helps and enhances your home with easy controling and automation of your NAD Receiver. You can do any automation right now and control over Homekit :slight_smile: