I tried a simple shell script to read ASCII temperature values coming from a sensor on RS485 in certain intervals.
read -r line < /dev/rs485
mosquitto_pub -h mqttbroker -t Temperatur -m $line -u user -P password -p portnumber -d
Wenn you receive data from RS-485 (ASCII with CRLF at the end) then it will be published to the mqttbroker.
You have to install mosquitto-client.
I would prefer a bidrectional solution, sending commands via a mqtt broker to an RS-485 attached sensor and receiving the answer.
Any suggestions for a simple solution are very much appreciated.