HDMI CEC on different device

Can someone aid me in the right direction? Im trying to configure a raspberry pi thats connected to my sony TV. The PI that is connected to the TV is not where my HA install is. I am currrently running homeassistant on a ubuntu 18 VM. i want to be able to to add and control my tv via HA.

I do this…will edit this post later with details.

Currently I just have pi connected and running basic HA install with little to no config to UI since I never use it. I set a bearer token for remote connection using API from main install

I use template switches/sensor to connect them. I tried mqtt eventstream/statestream and found that I did not like this method as it was 80%relaible vs 100% relaibility of API connection.

So I assume you understand the setup of HDMI CEC so I just explain my switch below.

I have projector connected to Receivers “monitor out”.
RasPi is connected to receivers source input PC (does not matter which)

for my switch I just send Power ON to all devices since I turn ON both Receiver and Projector but NO other source has actual ON/OFF state

For OFF I am sending standby to all sources for same reason. Also, I did not find unique ON/OFF for source and ultimately did not need

I am getting state of Projector only.

I add another switch for example. This is another RasPi used for remote open/close gate and provide sensor state of reed door sensor

########################################################
#                 COMMAND LINE                         #
########################################################
- platform: command_line
  switches:
    projector_jvc:
      command_on: '/usr/bin/curl -X POST -H "Authorization: Bearer my_unique_token" -H "Content-Type: application/json" http://192.188.10.93:8123/api/services/hdmi_cec/power_on'
      command_off: '/usr/bin/curl -X POST -H "Authorization: Bearer  my_unique_token" -H "Content-Type: application/json" http://192.188.10.93:8123/api/services/hdmi_cec/standby'
      command_state: '/usr/bin/curl -X GET -H "Authorization: Bearer  my_unique_token" -H "Content-Type: application/json" http://192.188.10.93:8123/api/states/media_player.hdmi_0'
      value_template: '{{ value_json.state == "on" }}'
      friendly_name: Projector
    southgate:
      command_on: '/usr/bin/curl -X POST -H "Authorization: Bearer  my_unique_token" http://192.160.27.52:8123/api/services/cover/close_cover'
      command_off: '/usr/bin/curl -X POST -H "Authorization: Bearer  my_unique_token" http://192.160.27.52:8123/api/services/cover/open_cover'
      command_state: '/usr/bin/curl -X GET -H "Authorization: Bearer  my_unique_token" http://192.160.27.52:8123/api/states/cover.south_gate'
      value_template: '{{ value_json.state == "closed" }}'
      friendly_name: South Gate

For anyone else who comes across this - There is the host: option within the official HDMI CEC integration which will allow you to run the commands remotely over TCP

Do you have an example config?

It’s provided in the documentation I linked to :slight_smile:
From what it currently says, the following would be correct when direct mapping name to physical address of device:

hdmi_cec:
  host: 192.168.1.3
  devices:
    TV: 0.0.0.0
    Pi Zero: 1.0.0.0
    Fire TV Stick: 2.1.0.0
    Chromecast: 2.2.0.0
    Another Device: 2.3.0.0
    BlueRay player: 3.0.0.0

reading is fundamental

Thank you