TCP control for Audio Amplifier

Hi,

I have an API document for my audio device. I can connect to the device using RAW TCP via putty on Windows 10 and gain full control.

My knowledge is limited with Home Assitant and I’m trying to find the best way of sending TCP commands and receiving the feedback.

Can someone point me in the right direction or provide a script or similar to help me on my way?

Thanks.

Can you give a bit more technical info? Is the api online?

The API is a 10 page PDF, Unfortunately I can’t link to it.

So far I have the below and it provides 2x on/off switch allowing me to select a specific input via Lovelace.

switch:
  - platform: command_line
    switches:
      218_cd:
        command_on: echo -e '#MSR CD' | nc 192.168.1.118 9014
        command_off: echo -e '#MSR SB' | nc 192.168.1.118 9014
      218_tv:
        command_on: echo -e '#MSR TV' | nc 192.168.1.118 9014
        command_off: echo -e '#MSR SB' | nc 192.168.1.118 9014

Obviously the good news is I have some control but there seems to be limitations. I am trying to create automations. When my TV goes into standby i want to turn off the Audio system. But it seems the HA GUI doesn’t allow me to select the switches as a device to control.
So I guess I need to look at setting up a device and not switches .

Use a service call action in the automation, not a device action.

Thanks for the help, initially I tried to use ‘call service’ but couldn’t find the entity. on the GUI when configuring automation I found the entity under the service ‘switch.turn_on’ selection. This is a typical thing of looking in the wrong place.

I’m still playing and I’m thinking there must be a better solution than using I/O switches. ideally, I need the ability to control inputs and volumes

What is this device?

Let me explain what I am achieving. I have an LG TV and a Meridian Audio amplifier. The amplifier needs to turn on with the TV and to be set to a specific input, in this case it’s called ‘TV’. When I turn off the TV then the amplifier needs to turn off (automatically).

The Meridian Amplifier is not a supported device in Home Assistance. I am able to control the LG TV via the WebOS integration found in Home Assistant.

With my work so far on this project I have Automations that turn on the Meridian Amplifier when the TV is on and to the correct inputs. I have similar automation when I turn the TV off. As an additional bonus there are IR code sets on the LG Store for their ‘magic’ remote to support Meridian volume and mute commands. This means I have a functioning system that only uses one remote control. BUT. I would like to also control the Meridian Amplifiers Volume directly from Home Assistant (via TCP). I may also use additional inputs on the amplifier, which is effectively a button push (not toggle or discreet on/off) thus not a switch. Hence my question on inputs.

I hope that helps explain my situation a little better.

Does the amplifier not support HDMI-CEC?

No, it’s an optical input from the TV.