Paho MQTT Connection

I’ve been using Hass.IO for my garage lights for a few weeks. I’m very pleased. Once I got some of the terminology sorted in my head (I’m still not here yet), it became smoother. I want to do a few more experiments before I release it on my house!

Namely, I want to receive some analog values from both Arduino and Rasberry Pi. I will also want to send some analog values (probably only to the Pi).

So, for the RPi, I’ve got a tweaked demo using Paho MQTT. It certainly receives the packet from Home Assistant: I go to developer tools / MQTT and issue plant/in with a payload of 123, and my Raspberry Pi prints the topic and payload. My Pi should also be publishing a value. I’ve used client.publish(“plant/out”,“50”).

So, first question: How do I get the published value in to HA? I believe I have to somehow make it recognise the published topic as an “entity”. I thought it might be as simple as adding to the configuration.yaml:

  - platform: mqtt
    state_topic: "plant/out"
    name: "output"

But that has not made the entity appear in the dropdown list when I add a card. What stage have I missed?

Second question: When it comes to analog output (from HA to the RPi), is there a card I can use which has a dial or a slider to set the value?


Yes, I even remembered to reboot HassIO!

Look at the MQTT discovery for HA and configure your rpi to send the config and appropriate state. It will make your life easier for programming more devices.