Hello everyone
I’m new to HA and I do not know this but I would like to integrate it with my current DIY home automation system.
Currently my DIY system is made up of 10 arduino connected via RS485. One of these arduino is connected to the serial port of a Raspberry Py via USB.
on the raspberry works a Python script that for every event receives a message arrey = [ID, x, y] where
ID = identifies the arduino number
x = identifies the type of status / sensor parameter
y = the value of the parameter
for each message received, the python script records the states or values in a mysql db and performs some automatisms.
The script can also send messages to turn on, turn off etc …
The question is, if I wanted to integrate the sensors / states into HA what could be the best optimal way to communicate with HA?
Es.
a) having the HA message read directly from serial? how can I do?
b) insert in the existing python script something that sends the message also to HA? does the way exist?
c) to read HA states / values in db mysql?
I think keeping things as simple as possible is probably your best criteria.
c) is possible using the existing sql sensor, but you are left running your python script and an extra database. HA already has its own sql database.
b) is the option I would choose, modifying your existing python program by translating the messages into MQTT messages to be sent to HA, and removing your SQL database. This also provides for two way communication if your arduinos also receive commands.
a) Would be best, as it would be simplest, but I don’t know of a way to do that.