S0PCM-Reader to read from a S0PCM-5/S0PCM-2 and send the total and daily counters via MQTT.
10K+
This is the Docker setup for the S0PCM-Reader application. This small Python application reads the pulse counters of a S0PCM-2 or S0PCM-5 and send the total and daily counters via MQTT to your favorite domotica application like Home Assistant. The S0PCM-2 or 5 are the S0 Pulse Counter Module sold by http://www.smartmeterdashboard.nl
I myself use it to count my water meter usage.
The Docker image is available for the following architectures:
amd64 - For regulair Intel/AMD systems (default)arm32v6 - For Raspberry Pi 1/2arm64v8 - For Raspberry Pi 3 and upI use the S0PCM-Reader to measure my water meter and normally in the Netherlands the water usage is measurement in m3 and not in liters. Only this S0PCM-Reader isn't really aware of liters vs m3, because it counts the pulses. So it is important for you to check how your e.g. water meter is counting the usage, my Itron water meter send 1 pulse per liter of water. This then means the 'measurement.yaml' file, which stores the total and daily counters, all should be in liters and not in m3.
The conversion from m3 to liter is easy, because you can just multiple it by 1000. E.g. 770,123 m3 is 770123 liter.

The configuration and measurement file options are described on the GitHub repository: https://github.com/ualex73/docker-s0pcm-reader
After you have downloaded and started the S0PCM-Reader, you need to configure your total pulse count to allow the S0PCM-Reader to relay the correct total count. Follow the following procedure:
<config>/measurement.yaml file1:
total: 370689
The 370689 is liters, which is 370m3
The totals and day counters will be published with the following topics:
<basetopic>/1/today
<basetopic>/1/yesterday
<basetopic>/2/total
<basetopic>/2/today
<basetopic>/2/yesterday
<basetopic>/X/total
<basetopic>/X/today
<basetopic>/X/yesterday
The <basetopic> you can configure in the mqtt section of the configuration file, the default is 's0pcm-reader'. The X is the input number, the name is configurable in the measurement file.
/config - The location where the configuration, measurements and logging are stored.
Launch the S0PCM-Reader docker container with the following command:
docker run [-d] \
--name=s0pcm \
-v /etc/localtime:/etc/localtime:ro \
-v /docker/config:/config \
--device /dev/ttyACM0:/dev/ttyACM0 \
ualex73/s0pcm-reader:latest
version: '3'
services:
s0pcm:
container_name: s0pcm
image: ualex73/s0pcm-reader:latest
restart: unless-stopped
volumes:
- /etc/localtime:/etc/localtime:ro
- /docker/s0pcm:/config
- /dev:/dev
devices:
- /dev/serial/by-id/usb-Arduino_LLC_Arduino_Leonardo-if00:/dev/serial/by-id/usb-Arduino_LLC_Arduino_Leonardo-if00
Content type
Image
Digest
sha256:4ecc48961…
Size
27.6 MB
Last updated
over 3 years ago
docker pull ualex73/s0pcm-reader