Watermeter pulse sensor S0PCM

Indeed, send me a private message in case of problems during integration.

Hi everyone i use the S0 Pulse Counter Module with 5 inputs from SmartMeterDashboard.nl

and thanks to the work of Jorei , it works. just when you use his code , dont forget to change the usb port in his code ( like i did)

I have installed this to my setup
But i do not see any extra sensors.
I have changed the serial device in sensor.py as i did not see any other place to specify it.
/dev/serial/by-id/usb-Arduino_LLC_Arduino_Leonardo-if00
Is this the correct way?

try /dev/ttyACM0 (if no other usb-ports are used) or /dev/ttyACM1 (if one usb-port was in use before plugging sensor in)

Min is actualy /dev/serial/by-id/usb-Arduino_LLC_Arduino_Leonardo-if00

Hi I have 4 inputs:

  • 1 Solar panel
  • 2 Kwh meters for Electric car and Jacuzzi
  • 1 water meter

I like to see the (near)realtime usage.

As far as I know the S0pcm module sends the pulses per channel every 10 seconds, so it must be possible to know the current usage or production.

Unfortunately Iā€™m not a python expert, so if anyone could help me with a script which puts the number of pulses per 10 seconds interval in a HA entity it can easily be used to do what I want.

Thank youā€¦

Is there anyone who van give a little push in the richt direction?

Interested in this as well. I have 3 DDS353 kwh meters in my fuse box, 1 for each circuit. Would like to be able to read them with an S0PCM like this and send that data to HA via MQTT using ualex73/docker-s0pcm-reader: S0PCM-Reader (github.com)

Is it worth getting this module and going this route?

I think this project might be a better choice to get our S0 pulses into HA. No expensive cables needed, just an ESP, some wire and a resistor per channel. It looks like itā€™s about to get merged in ESPHome.

How to count pulse frequency accurately with ESPHome? - Third party integrations / ESPHome - Home Assistant Community (home-assistant.io)

Hi,

I just migrated from Domoticz to Home Assistant (hassio) on Rasparian Pi 4.
Configured most of my hardware and created some Node Red flows.

The on thing i cant figure out is how to get my S0 meter working with Home Assistant. In Domoticz it was 2 clicks and ready. I have read a lot in the forums etc.

Jorei/homeassistant.sensor.cyble

is offline or doesnt exist anymore. I run HASSIO os on Rasparian Pi 4

What steps should i take? I have the 5 port version S0 meter.

If someone could provide me with some info, this would be great!

Thanks and greetings Alex

Hi,

I also migrated from Domoticz and indeed it is a few clicks and S0 works. (3 kWh meters on 5 port usb converter)
By setting up mysensor I get the data in HA but I need some help how to display this in HA.
Alex hope this helps you a bit in the right direction and you or somebody else can help me out in displaying the data.

See below my data
2021-08-29 08:27:30 DEBUG (MainThread) [mysensors.transport] Receiving ID:3781:I:10:M1:0:1427404:M2:0:0:M3:0:48999:M4:0:0:M5:0:772039

2021-08-29 08:27:30 WARNING (MainThread) [mysensors.message] Error decoding message from gateway, bad data received: ID:3781:I:10:M1:0:1427404:M2:0:0:M3:0:48999:M4:0:0:M5:0:772039

2021-08-29 08:27:30 WARNING (MainThread) [mysensors] Not a valid message: not enough values to unpack (expected 5, got 0)

Thanks,
Ronald

Hi Ronald,

I tried several things, but none have a working S0 meter for me. I cannot install a custom docker on HASS.io How do you setup mysensor so the devices occur? Thanks in advaced. Can you add the code? or Config? Have you gotten any further?

Greetings Alex

Can I use this with the Cyble Itron as well?

Ah, I see how it works, I plug the Cyble Itron into that pulse counter. Too bad they donā€™t sell it at that shop anymore. I ordered one of these instead, I assume it does the same thing.

Hi warrior,

Are you willing to share that code?
The link to the cyble github page seems to be offline.
Thanks!

@meijron @Jorei and everyone else :crazy_face:

I have tried to get the github docker active by using the wget command in the terminal.
But after that I see that I succeeded, but no new folder in file editor of HA so I wouldnā€™t know how to take my next steps?

-Or do I have to download and upload the configuration example myself?
-Do I have to add text ā€œplaformā€ somewhere in the main configuration file afterwards?

Did the following but do not get any further in home assistant, or should I not have done it via wget?

Initial Configuration To use the S0PCM-Reader you need to configure it, this can be done in 2 ways: * Start the S0PCM-Reader and the default configuration will be copied into the /config folder * Download the example configuration.yaml with the following command (we use wget for this) into your /config folder:

Seems so: I configured it as such (for measure of car charger):

- platform: serial
  name: "pulse_counter"
  serial_port: /dev/ttyACM0
  baudrate: 9600
  parity: E
  bytesize: 7
  stopbits: 1

sensor:
  - name: "laadpaal_current"
    unit_of_measurement: "kW"
    state: "{{ 3600 / ( ( 10 / (states('sensor.pulse_counter').split(':')[5] | float / 3 )) * 1000 ) }}" # 3600 / (sec per flash * imp/kWh)
  - name: "laadpaal_total"
    unit_of_measurement: "kWh"
    state: "{{ states('sensor.pulse_counter').split(':')[6] | float /3 * 0.001 + ( states('input_number.start_balance_laadpaal') | float ) | round(3)> 
  - name: "laadpaal_total_pulses"
    state: "{{ states('sensor.pulse_counter').split(':')[6] | float / 3 }}"

It currently reads too much so I divide by 3ā€¦ I have it on a separate usb powered hub. Still tweaking with positioning and cable length. I added an input_helper as starting kWh balance.

I do not know if it is still relevant, but I made my S0PCM-5 module working in HA 2022.6

For readability Iā€™ve split up my configuration files.

In configuration.yaml:

 sensor: !include_dir_merge_list sensors/

In config/sensors/s0pcm5.yaml:>

- platform: serial
  name: s0pcm5
  serial_port: /dev/serial/by-id/usb-Arduino_LLC_Arduino_Leonardo-if00
  baudrate: 9600
  parity: E
  bytesize: 7
  stopbits: 1

- platform: template
  sensors:
    s0pcm5_m1:
      unique_id: s0pcm5_m1
      friendly_name: Office usage
      unit_of_measurement: "kWh"
      value_template: "{{ (states('input_number.m1_offset')| float  + states('sensor.s0pcm5').split(':')[6] | float / 1000 ) | round(2) }}"

The first block is to make the information available in HA. I used the ā€˜by-idā€™ name of the serial port, because the enumeration can change if you have more USB/Serial devices connected. I need to think of a solution if more than one Leonardo is connected, but that is something I will address when it happens :slight_smile:

The second block is repeated four times (for m2-m5), because I have a S0PCM-5.
The unique-id gives access to this sensor through the GUI
The uom makes the values available for graphing (I use grafana/influx)
The index [6] is for the M1 value (see a previous post in this thread).
The other indices are [9], [12], ]15] and [18]
I divide the value by 1000 because I want kWh (the counter counts Wh)
I use a helper to get an offset (for syncing the counter in HA with the device)
I round on 2 digits to get the same values as the counter on my devices (youless) shows (provided you have put the right offset value in the corresponding helper)

I do not yet know when the counters will reset (the used counter counts since last startup)

This config gives me 5 sensors with the exact same values as shown on the devices itself.
Next step is to use the utility platform, but I havenā€™t looked into that, yet.

Hope this helps some people!

Regards,
Marcel

3 Likes

Hi WiWo, thanks for the write up, it got me along my way to get the S0PCM-5 working.

one question, where does the 'input_number.m1_offset' value come from?

It is just a helper (five of them, in fact).

Go to Settings => Devices & Services, and choose the tab ā€˜Helpersā€™
Then ā€˜Create Helperā€™ and choose a ā€˜Numberā€™ helper.

I named mine ā€˜m1_offsetā€™. Once created, you can change the name, but then only the friendly name will change. The sensor will still be ā€˜input_number.m1_offsetā€™

This input is available on the default dashboard, and can also be added to your own dashboards. Just enter the value there.

FYI: I weekly check my counters in HA with those on the device itself, and they are still in sync.

I am also planning to use one channel for Water Measurement, which is in m3. But the rotator on the meter is one revolution per liter, so I also need a correction here.

Alas, Today I checked again, and apparently I missed quite a few pulses. Going to investigateā€¦