Home Assistant Integration with HTD MCA-66

Recently I’ve been playing with Home Assistant (Hassio) to have a single pane of all my smart home devices (Zigbee, Z-Wave and IP devices) without having to switch apps to control different devices. One of the major advantages of using home assistant is the plethora of customizations available which can even extend to Google Home and Amazon Alexa. This post will assume you’re already familiar with Home Assistant and focuses on the Home Theater Direct (HTD) integration with the model MCA66. This should work similar with the Lync model by changing the hex codes which is available from HTD.

Most of the code seen here found on different GitHub repositories, but none were specific to my application. They either used Serial communication, or an additional web service and leverages REST api.

  • https://github.com/whitingj/mca66
  • https://github.com/steve28/mca66

For my use case, I only went as far as creating on/off and volume sliders for 4 zones. I use the home assistant Sonos integration for selecting music and sources. The code could be cleaned up as well but haven’t found the time yet.

Instructions

platform: command_line
 switches:
 #Zone1 - Master Bedroom
 #Zone2 - Garage
 #Zone3 - 1st Floor
 #Zone4 - 2nd Floor
   htd_masterbedroom: 
    command_on: "python3 /config/htd.py pwr 1 1"
    command_off: "python3 /config/htd.py pwr 1 0"
    friendly_name: "Master Bedroom"
    value_template: "{{ value == 'on' }}"
    command_state: "python3 /config/htdquery.py querypwr 1 0"
   htd_firstfloor: 
    command_on: "python3 /config/htd.py pwr 3 1"
    command_off: "python3 /config/htd.py pwr 3 0" 
    friendly_name: "First Floor"
    value_template: "{{ value == 'on' }}"
    command_state: "python3 /config/htdquery.py querypwr 3 0"
   htd_secondfloor:
    command_on: "python3 /config/htd.py pwr 4 1"
    command_off: "python3 /config/htd.py pwr 4 0"
    friendly_name: "Second Floor"
    value_template: "{{ value == 'on' }}"
    command_state: "python3 /config/htdquery.py querypwr 4 0"
   htd_garage:
    command_on: "python3 /config/htd.py pwr 2 1"
    command_off: "python3 /config/htd.py pwr 2 0"
    friendly_name: "Garage"
    value_template: "{{ value == 'on' }}"
    command_state: "python3 /config/htdquery.py querypwr 2 0"
  • If you want to customize the icons to match my screen shot, add the following homeassistant/customize section of configuration.yaml
switch.htd_garage:
  icon: mdi:speaker
  assumed_state: false
switch.htd_masterbedroom:
  icon: mdi:speaker
  assumed_state: false
switch.htd_secondfloor:
  icon: mdi:speaker
  assumed_state: false
switch.htd_firstfloor:
  icon: mdi:speaker
  assumed_state: false
  • Add the following lines in the homeassistant/packages section of configuration.yaml. This configures the slider bars for volume and limits the volume to 60 (matching HTD).
pack_1: !include /config/packages/mca662.py
  • Use the Check Config button to confirm syntax, restart your HA server.
  • Create a new lovelace ui card and add the following:
entities:
  - entity: switch.htd_firstfloor
  - entity: input_number.slider3
  - entity: switch.htd_masterbedroom
  - entity: input_number.slider1
  - entity: switch.htd_garage
  - entity: input_number.slider2
  - entity: switch.htd_secondfloor
  - entity: input_number.slider4
show_header_toggle: false
title: Speakers
type: entities

This should be all you need. I will update this post if I find time to create source selection, mute, party mode or other functions.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>