Create list from MQTT Topic States, input to text entity

Hi everyone,

I’ve really tried understanding all this, I’ve been bashing my way through various forum posts for days trying to work this out for myself, but I really just need to ask for help now.

I have PAI (Paradox Alarm Interface) running on my Home Assistant, which publishes all of my alarm’s information to the MQTT database.

If I bypass a zone on my alarm, or bypass it by publishing to the MQTT database, the following state topic changes from False to True: paradox/states/zones/“zone name”/bypassed

I want to write a script to retrieve the current bypassed states from the MQTT database and input them into a list or entity of some description. The idea is that I can trigger the script either manually, or otherwise, and the list of bypassed zones is updated.
I can then display this list of bypassed zones in lovelace.

I’m a complete noob with MQTT, and I just can’t seem to understand the simple concept of “querying” the database without publishing or listening. i.e. I just want to check what the current value is of a topic, and record that.
The closest thing I have found to this is running mqtt.dump, specifically on “paradox/states/zones/+/bypassed”, which returns a list of the raw bypassed status of the zones (by reporting either True or False for each topic, in a text file).
See below:
image

I would be happy to continue with the mqtt.dump method, but then the next issue is how do I handle the mqtt_dump.txt file? I would want to remove/replace all of the “paradox/states/zones/” text, and somehow update a text entity just with the zones which have “True” as their state. So that I can simply display this entity on a lovelace card as a start.

I’m sure an experienced user reading the above can see that I have not grasped a number of MQTT concepts, but that’s really the issue. I don’t know what the best approach is to achieve what I’m trying to do, because I just can’t work out how to start properly.

Thank you!

At a high level:

You need to configure the MQTT integration to speak to your broker: MQTT - Home Assistant

From there, each of those topics can be an MQTT sensor: MQTT Sensor - Home Assistant

You will end up with a sensor for each topic with the state as “True” or “False”.

If you want to manipulate this further, you can use a template sensor to put each zone into an attribute: Template - Home Assistant

You can either display each sensor directly in a UI card, of you can also use a template in your UI card to show only the ones which are “True”. I don’t do much manipulation of the UI like this so that’s where my knowledge ends.

Hi Aaron,

Thanks for your reply. I did think about this route, but I really thought there would be a more elegant method than simply having one sensor for each MQTT topic. It just seemed a little messy to me, but maybe I’m overthinking it.

I can just add all these sensors to my config and be done with it I guess.

Thanks