Configure emonhub.conf Reading data from gpio


I am trying to upgrade my emonpi. I’ve already installed a RPICT4T4 which works fine.

No I like to add more temperature sensors. On a 2nd Raspi I got 10 DS18B20 working on gpio4. Now I want to connect at the emon-raspi and emoncms. I am wondering how to configure '/home/pi/data/emonhub.conf` that these temperatures are availble as nodes inside emoncms. In the documentation I don’t find advise for that matter.

My question: How to setup emonhub.conf to read data from gpio directly?


The quick answer is “you can’t!”, but it is possible in-directly.

There is currently no emonhub interfacer published to do what you ask. I have used custom scripts to read ds18b20’s via the Pi’s GPIO and submit via an emonhub socket interfacer. I recently had 88 ds18b20’s connected to a Pi via 8 separate buses on 8 GPIO pins so that all 88 sensors could be read at full resolution comfortably within 10secs.

If this method is of interest to you I can perhaps share some code to get you started.

1 Like

It sounds exactly to my plan. I have 8 ds18b20 on a single GPIO. Until today I have no problems. I have cable length between 1 and 5 m on this finger.

I have a small script from somewhere which prints the temperature on screen. So, I proceed to build a dictionary and send the data like described by the Input-API.

What would be the best method in this case? If you have some hints or a snipped for that, I would be glad.

Here the code for reading sensors: (689 Bytes)

Just fire it via MQTT with a base topic of emon.

I’m sorry. I don’t see your point. I have absolutly no idea how to configure and perform this. Maybe tomorrow I have enough time to study.

Search for “Python MQTT post”. It will throw up this (these tutorials are pretty good) How to Use The Paho MQTT Python Client - Beginners Guide

Use the base topic emon and the sensor data either as a JSON object or individual values with their own topics. You will need the username an password for the MQTT broker on the EmonPi (it’s in the docs somewhere).

:star_struck: Never searched outside of this forum for that. Thanks:+1: