Support for reading Dutch Smart Meter (electricity/gas) (P1 port)

I added it as a task, I probably can get to it in the next few days. https://github.com/home-assistant/home-assistant/issues/6218

I’m not sure if the question is allowed, if not please remove. :confused:

Is there anyone in the Netherlands who can help me with a wireless hardware solution that works with this code?
My HASS PC is to far away from the P1 port so USB is not an option.
Maybe an easy manual or a address to buy one, thanks in advance :innocent:

For the creators of the code, awesome work, thanks. :wink:

I use this (see link below) but still did not have a chance to test. I think there are people also using this, pls check the whole threat.

This is a wireless solution http://www.esp8266thingies.nl/wp/ It uses the espeasy pluging https://github.com/letscontrolit/ESPEasyPluginPlayground/blob/master/_P110_P1WifiGateway.ino

I’m not sure if (how) this works with @aequitas his component.

Hi, I am fairly new to the Home Assistant system.
I have got the “Slimme meter” working on my new PI.
I have noticed that the telegrams got pushed to the homeassistant.db file but after a couple of days the system got a bit slow.
After some investigating I found out the homeassistant.db file got very large because of the telegrams that have been pushed every 10 seconds.
After some reading on the forums I have setup a MySQL database on my NAS and now everything is good/snappy again.
Now my question, is there a file that I can edit so that I can change frequency that the telegram gets pushed from maybe 10 seconds to 1 minute or more so that my MySQL DB doesn’t get filled up that fast?

Sorry for my bad English, it is not my native language.

Thanks in advance

Best thing you can do is purge your database (removing all values older than 7 days) and for the logging revert to influxdb. Some useful documentation on the known error of huge data see files can be found at Large homeassistant database files

I am using this wireless solution: http://www.esp8266thingies.nl/wp/
But I am getting CRC errors. If I set it to dsmr_version 2 it’ll work (but with incorrect/missing data, since it parses as 2 instead of 4).
Smart Meter; Kaifa MA105C -> p1 wifi gateway -> dsmr sensor in home assistant

Does anyone happen to know how to fix this or what the problem might be?

p1 gateway set as, 115200 8N1

Quick and dirty hack;
In deps/dsmr_parser/parser.py
I commented line 92:
# self.validate_telegram_checksum(line_values)

The p1 wifi gateway already does CRC validation, and I am guessing somewhere in the next step something minor changes. So for now I just disabled the validation in the dsmr_parser and all the values appear correct in my dashboard.

If anyone with DSMR5 feels like giving this a try.

Could you raise this issue at: https://github.com/ndokter/dsmr_parser/issues and provide some output of the p1 wifi gateway?

I would like to see friendly_name on the sensors so I can translate the english names to my local language (Dutch) in configuration.yaml

I create a template now to make the translation:

  • platform: template
    sensors:
    stroom_verbruik:
    friendly_name: Stroom Verbruik
    value_template: ‘{{ states.sensor.power_consumption.state }}’
    unit_of_measurement: ‘kW’
    icon_template: mdi:flash
    stroom_verbruik_laag:
    friendly_name: Stroom Verbruik Laag
    value_template: ‘{{ states.sensor.power_consumption_low.state }}’
    unit_of_measurement: ‘kWh’
    icon_template: mdi:flash
    stroom_verbruik_hoog:
    friendly_name: Stroom Verbruik Hoog
    value_template: ‘{{ states.sensor.power_consumption_normal.state }}’
    unit_of_measurement: ‘kWh’
    icon_template: mdi:flash
    stroom_export_laag:
    friendly_name: Stroom Export Laag
    value_template: ‘{{ states.sensor.power_production_low.state }}’
    unit_of_measurement: ‘kWh’
    icon_template: mdi:flash
    stroom_export_hoog:
    value_template: ‘{{ states.sensor.power_production_normal.state }}’
    friendly_name: Stroom Export Hoog
    unit_of_measurement: ‘kWh’
    icon_template: mdi:flash
    stroom_export:
    friendly_name: Stroom Export
    value_template: ‘{{ states.sensor.power_production.state }}’
    unit_of_measurement: ‘kW’
    icon_template: mdi:flash
    stroom_tarief:
    friendly_name: Stroom Tarief
    value_template: ‘{{ states.sensor.power_tariff.state }}’
    icon_template: mdi:flash
    gas_verbruik:
    friendly_name: Gas Verbruik
    value_template: ‘{{ states.sensor.gas_consumption.state }}’
    unit_of_measurement: ‘m3’
    icon_template: mdi:fire
    gas_verbruik_per_uur:
    friendly_name: Gas Verbruik (uur)
    value_template: ‘{{ states.sensor.hourly_gas_consumption.state }}’
    unit_of_measurement: ‘m3/h’
    icon_template: mdi:fire
    energy_generation:
    value_template: ‘{% if is_state_attr(“sensor.pvoutput”, “energy_generation”, “NaN”) %}0{% else %}{{ “%0.2f”|format(states.sensor.pvoutput.attributes.energy_generation|float/1000) }}{% endif %}’
    friendly_name: ‘Generated’
    unit_of_measurement: ‘kWh’
    icon_template: mdi:flash
1 Like

Please look into customizing (https://home-assistant.io/docs/configuration/customizing-devices/) that should provide that functionality.

I noticed that after version 0.6 of the dsmr_parser (that is used here) some additional fixes with regards to CRC errors (https://github.com/ndokter/dsmr_parser/issues/17) I was planning on seeing if I could test and/or integrate the newer version. I was also informed that Domoticz also fails on the CRC parsing at the moment.

But I guess I can make an issue, with all this information on github :slight_smile:

Is there a nice way to combine the power_consumption_low.state and power_consumption_normal.state in a single value?

Thanks.

Totally forgot. Yes this will do the trick.

Has anyone been able to get the notify.REST platform working for publishing to mindergas.nl?

I never managed to get it working reliable so I now have a python script which I run through from every night at 0.45. script is below

import requests
import json
import datetime
import homeassistant.remote as remote

mindergas = “http://www.mindergas.nl/api/gas_meter_readings
mindergas_token = ‘XXXXXXXXXXX’
hass_ip = ‘127.0.0.1’
hass_password = ‘’
hass_port = ‘8123’
gas_sensor = ‘sensor.gas_consumption’
api = remote.API(hass_ip,hass_password, hass_port)
gas_usage = remote.get_state(api, ‘sensor.gas_consumption’)

def post():
yesterday = datetime.date.today () - datetime.timedelta (days=1)
data = {‘date’: yesterday.strftime (“%Y%m%d”), ‘reading’:gas_usage.state}
headers = {‘Content-Type’: ‘application/json’, ‘AUTH-TOKEN’: mindergas_token}
r = requests.post(mindergas, data=json.dumps(data), headers=headers)
print (yesterday.strftime (“%Y%m%d”))
print (data)
print (r)
print (‘Ready’)

post()

I’m using a Python script too but the using the Notify.rest platform is a much more elegant solution. I’ll have a look at it.

Whatever you do; post the outcome here please :slight_smile:

I think you can use this: