Multiple MQTT sources

Hello,

I am quite new to Home Assistant and have run into a problem I was hoping to get some help with how to address.

I am using an external service that extracts my energy consumption from the suppliers api and publishes the data to a mosquitto broker that I have, I then have MQTT configured in Hass and consume the data from the broker.

I have now purchased a SONOS Zigbee dongle that I have connected to a Raspberry PI (not my Hass instance) and configured zigbee2mqtt with a mosquitto instance running on the Pi as well. I was hoping it would be as simple as adding this as a second MQTT integration to consume the data, but it turns out Hass can only have a single connection to one broker and if I understand it right only consume a single topic from that broker.

My Home Assistant environment runs in Kubernetes across 2 pieces of hardware, so adding the dongle as ZHA is not an option.

I am assuming that there is a solution to this, as consuming 2 MQTT sources doesn’t sound like an edge case, is there an obvious solution here ?

1 Like

What about moving the Hass-configured MQTT broker to the Pi as well?

Can you please expand on how that would help ? I could publish the zigbee2mqtt data to the same mosquitto instance as the energy data as well but how would I configure Hass to subscribe to the 2 different topics ?

Sorry I read a bit fast, I was thinking the main idea was to get Z2M up and running on hardware outside your kubernetes cluster. No idea about the multiple topics part, didn’t know that was a limitation.

Not quite. There is a single “discovery” topic, indeed. That topic is for automatically configured MQTT entities, but you can have as many manually configured MQTT sensor on arbitrary topics as you want.

How do you import from MQTT to HA, here? Through discovery or through manual entities?

I’m not sure to be honest what the discovery vs manual entities means, and perhaps this is where I am going wrong.

I have simply configured the MQTT integration in HA, pointed it to the mosquitto kubernetes pod and subscribed to the topic “Homeassistant” as per the instruction from the energy app, following this the entities are created automatically. Is that considered “Discovery” or “Manual” ?

If you didn’t manually configured the MQTT entities, that’s “discovery”. Does your “external service” explicitly supports HA?

Nothing prevents you to point both your supplier data and zigbee2mqtt to the same discovery topic on the same broker, though.

It does support publishing to a MQTT broker for use with HA, or/and the data can be sent to an InfluxDB to be displayed with a Grafana dashboard

I will try and configure zigbee2mqqt to send the data to same broker and topic and see if that works

So clearly I was overthinking this, I just updated the zigbee2mqtt config file with the energy broker as target, without even changing the topic, joined a zigbee device and it showed up straight away in HA.

Thanks for your help.