Remote USB Sensor data collection to integrate in HA

Hello,

Like everybody will guess, I’m not an Home Assistant expert, this is why I’m posting this, I would need some help at some point.

What do I do ?
I use HA to monitor some information about my home, like temperatures, NAS status, etc.
So far, I was rather lucky to only have “easy to integrate” sensors that I only have to have recognized by HA (like switchbot sensors for example).
More recently I went into integration for some others home sensors like Radon meters.
I have two of them to the home configuration, one is a Airthings sensor which was easy to integrate too, but the other one is a USB recorder. It’s not really communicative and since some recent updates it displays data in russian on its screen which is not really user-friendly.
I went through the process of reading data from this device and get it as a string value (like “12.6” for temperature) and other readings.
This is done using a Raspberry Pi Zero to which the radon detector is plugged (USB) to get data but also because the sensor internal battery is getting weak.

What would I like ?
To have this data displayed within HA for real time reading and also to have the history available for interpretation.
Later on, data would be used in scenes to activate ventilation about a defined value.

What do I need help with ?
I would like to have ideas about the best way to achieve this data reading and saving through HA without creating a too complex system.
At first, I went through Zabbix installation to save and collect data from the sensor and I seen that it could be possible to integrate Zabbix with HA, but I’m not really sure I could access my data within HA.
In addition, Zabbix is rather heavy for the Pi Zero and I experience lag times with this.
I noticed that I could write the data to a local MySQL database as well or anything else.
Here I miss experience to get what would be the smartest way to get to do this…

Thank you for your time and suggestions

That depends on what type of communication the USB device uses. You haven’t mentioned the API. Start there.

The zabbix integration requires a server. Not sure what this is, but you’d need that first.

Hello Petro,
Thank you to help me get my question more precise.

I was not so clear about the data reading. This is already working and setup.
The USB Radon sensor is connected to a Pi Zero in basement.
The Pi Zero collects the temperature, the relative humidity and the radon level.
This data is stored in a local MySQL DB and shared within a Zabbix server (hosted on the Pi Zero as well). This is when I seen that the Pi Zero experiences lag times and because the Zabbix integration seems rather heavy, that I wondered if I didn’t tried to make something rather complex to achieve something more simple… :smile:

Appart from this Pi Zero, I have a HA Server running elswhere at home, and I would like to “get” the 3 readings (T°C, H%, Bq/m3) to read and store them withing HA and this is where I’m looking for “ideas” about the best way to achieve it.

I’m not sure what zabbix is, but if you have a pi zero running, you could use MQTT instead of zabbix. Host the MQTT server on your HA system and have the pi zero sub to a few topics and place the info there.

That’s typically the best route to go with DIY things of this nature.

Zabbix is more designed to follow up servers health (Temperature, disk space and many many toher things) on the system on which its installed. It has several add-ons to capture other data and this is what I was using, but it’s heavy and not designed for what I use it for.
I will have a look at MQTT, thank you.
Tell me if I’m wrong, MQTT would then be a listening server on my HA and the Zero would then “send” data to it ?
Do you have some details about the client side ? (Pi Zero)

You’d make a script via a software language that constantly runs and is connected to an MQTT server. If that is above your head, the pi zero may not be suitable enough for you.

When you mention the MQTT Server, on HA side, is it like MQTT Mosquitto embedded in HA or is it something else ?
I seen I can create listeners in its configuration page…

Scripting on client side sounds okay with some training. I already did some to get the USB device to share its data with the Pi Zero.

You can add mosquitto to HA via the MQTT addon, which will add a mosquitto broker inside the HA machine (it runs next to home assistant).

Hi,
What’s your Linux shell scripting knowledge like?

I gather data from a Linux box and use mosquitto_pub to publish data to MQTT, and hence into HASS.

Here’s a walkthrough of setting up MQTT on HASS:

Here’s an example of mosquitto_pub complete with fully-automatic discovery in HASS down to creating entities with icons:

If this helps, :heart: this post!

My linux shell scripting is rather low, that’s not like bicycle, slowly forget it… :slight_smile:
I’m having a really hard time setting up the MQTT on both sides.
The client speaks on the network, but doesn’t share all that HA is expecting, and when I tried the HA syntax then it still doesn’t seem to be visible for my HA instance.
I would like to precise that I’m using HA as an OS version, so I noticed I can’t access to everything and I’m not sure that the Mosquitto is properly set to listen to streams.
I came up with another solution that I can’t have workable either :frowning:
I had the idea to write the data to a SQL DB and have HA to go read those sensor values, but I get the permanent invalid query error (I see many people got it too) without to really know what is wrong…

In that case…