Receive sensor values from Home Assistant through Serial communication

Hi,

I setup some sensors from NodeMCU with Home Assistant. I wrote a python script that gets gets the values from serial communication and through MQTT, publishes the values to Home Assistant and things work perfectly.

Next step I want to do is to log the sensor values in a NoSQL database. And this is where I’m confused. I’m not able to integrate a NoSQL database with Home Assistant. Is it possible to use MongoDB with Home Assistant?

The other alternative I’m looking is to get those sensor values from the Home Assistant and then write a python script that takes the values through serial communication and sends it to the database. For example, get temperature sensor value from Home Assistant and send it to the database. Any idea how to do it?

I’m a beginner so any hints would help. Thanks a lot for your time.

Why not write another app that listens on the same MQTT topic as Home Assistant that writes to this database? Since it’s already on MQTT, any computer in your network should be able to handle this task. I don’t see a reason Home Assistant needs to be involved in parsing the MQTT message, then retranslating it out again.

You can get the entire database in Home Assistant in many ways. Using the rest API would be a good place to start.

https://developers.home-assistant.io/docs/en/external_api_rest.html

With this, you will be able to get whatever you want out of Home Assistant…and again don’t even have to be running on the same PC to manage it.