1Wire on Raspi via Mqtt

I have set up a small 1Wire bus with temp sensors on my Raspi via the GPIO (similar to http://www.netzmafia.de/skripten/hardware/RasPi/Projekt-Onewire/) wich works fine.
The Senor data now resides in a pseudofile: /sys/bus/w1/devices/10-000802cfb15d/w1_slave - one for each sensor.

I’d like to post this data to a MQTT Broker and I am looking for a decent client to do so. Any ideas here?

Ultimatively I’d like to use ghe MQTT Binding on OH but also some other clients are supposed to subscribe to them.

Install owserver and configure OH to talk with it. Then you can use onewire binding to obtain the data from 1-wire bus and OH will publish data via MQTT.

Number TemperatureOffice “Ambient Temperature [%.1f °C]” (Temperatures) { onewire=“deviceId=28.6E0E63071234;propertyName=temperature”, mqtt=">[broker:myhouse/office/temperature:state:*:default]" }

owserver requires some adapter to interface with the bus. I would recommend to use the adapter ‘in production’, but for quick test you can probably use something like this.
In fact, that was referenced in this community earlier.

Thanks a lot, I actually found the paho.mqtt client for python.
I enhanced the script from the example and it nicely passes the measurements to mosquitto.

1 Like