How to implement a custom MQTT device (Home Theater Receiver)

Hi,
I know this question has already been asked but it doesn’t answer to my case. I’m pretty new to HA and I don’t understand everything yet.
A long time ago I builded an adapter that makes Sony Control AII protocol available in an MQTT broker, to remotly send commands and control / automate my old Receiver. It works like a charm but now I want to integrate it to HA, but, I don’t understand how. With my actual setup I can control input channel, volume, power, and many other. I saw that in HA I can add a custom MQTT bynary sensor, switch… but not as a single device, and I want all state and commands to be in the same device, not just have on off… Can someone explain me where I’m wrong please ? I don’t know if my question is really clear but, thanks by advance for your advices.

1 Like

Devices in home assistant are comprised of entities. An entity in home assistant is a single state. Entities can have numerous attributes associated with that single state.

You can create all 3 from MQTT discovery. Home assistant relies on a configuration for a device or entity. If that configuration doesn’t exist, it doesn’t know what topics are associated with that device or entity.

You can keep your current setup to automate your receiver, all you need to do is establish a configuration for home assistant to know how to handle your device.

Through YAML, you can only create entities. Through MQTT automatic discovery, you can create whatever you want (including devices).

1 Like

Thanks for your answer.
If I understand well, I’m better to rewrite my MQTT implementation to match HA MQTT Discovery specification, and then, if well setup, my Receiver will show up with a device that has many entities, that’s right ?
Thanks for your link

your topics and data shouldn’t change. You need to ADD discovery information as a topic that follows the discovery protocol. Follow the link I provided from top down and hopefully you’ll understand what you need to add.

But you basically need 2 things:

  1. A configuration via a topic
  2. A topic(s) that contain(s) your sensors data that’s continuously updated.

Home assistant then configures it self using #1. That configuration pulled from #1 tells home assistant what the data is for #2. Home assistant then creates the sensor for #2 and uses #2 to update said sensor.

1 Like

Ooooh, yeah I understand now ! I’m going to try it. Many thanks, Have a nice day !


Thanks a lot !! Thanks to you I achieved what I tried for more than a week, now, it finally works !

3 Likes

hey there! would you be able to link to some documentation that you used to help build out your discovery packet? or would you be able to share your packets that you crafted? I’m struggling to find documentation on this but this is similar to what I want to do, too!

2 Likes

Hey @Seb7o,
Can you post you configuration please?
Thanks.

3 Likes