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

Should be possible. I don’t have any example of that information. If you are able to provide test data I can create a parsing test for it and work it into the component from there.

I’m not a programmer at all… So if you explain me what you need from my side I will help you. My Power meter is an Kaifa E0026 and I am running on DSMR 4.0.

Can you try out if this works: https://github.com/aequitas/home-assistant/blob/dsmr/homeassistant/components/sensor/dsmr.py

After much attempts (=‘klooien’) I managed to get the python script for mindergas running. See the result below:

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

mindergas = "http://www.mindergas.nl/api/gas_meter_readings"
mindergas_token = 'PUTYOURTOKENHERE'
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()
1 Like

I’m glad you got it working!

Thanks for sharing !

I got it working except from the automation part. I created an alias in .bashrc, this alias calls the python script. When I enter the alias on the cli it sends the data to mindergas.nl and I get a 201 response. It seems the script/alias is not triggered by the automation part. Am I missing something ?

@piotr: did you add it to the bashrc of the user that runs the hass process?
I’m thinking of letting it run by cron because hass crashed during the night (out of memory error?) and nothing got uploaded last night…

Great work on this module, it sounds very nice.
I just ordered the the setup that will make the data available through wifi and I can’t wait to try it. Is the tcp/ip support already live?

This might not be the right place to ask but is there any plan to add a feature where we could specify the sources for certain power usages, so we can see which appliances are currently on?

I did but it didn’t work. I made a cron job.

Weird. Was running this component through custom_components setup. Got a spare moment, tried to upgrade Home Assistant. Removed the custom component, as it is now in the stable release and I wanted to use that one. Upgraded Home Assistant, no dsmr.py file? What am I missing? Since I see it in the Github repo and other components got refreshed.

Works great, using the ‘ISKRA AM550’ :+1:

How can we implant this in our configuration?

Hi,
For testing the tcp function.
Do I just replace the dsmr.py you linked or is there more I should do?
I have the same P1 wifi cable and I would love to test this.
What additional parameter do I add to the config “host”?

Yes, just put this in your custom_components/sensor https://github.com/aequitas/home-assistant/blob/dsmr/homeassistant/components/sensor/dsmr.py and then just add a ‘host’ config item with the hostname/ip and the ‘port’ parameter is then used for the tcp port instead of the serial port.

Let me know if it works for you then I can add it as a feature.

Great, it works, I am now seeing the data in the home assistant dashboard.

Thanks for working on this!

Thanks for testing it out. I will try to get it into the next release.

Is there any way to turn of the Power Production part?
I have no means of producing power so all it does is clutter my front end :smiley:

Just noticed I do still get some errors in the logs:
16-12-23 16:08:13 dsmr_parser.parsers: No line class found for: ‘/KFM5KAIFA-METER’
16-12-23 16:08:13 dsmr_parser.parsers: No line class found for: ‘’
16-12-23 16:08:13 dsmr_parser.parsers: No line class found for: ‘0-0:96.7.21(00000)’
16-12-23 16:08:13 dsmr_parser.parsers: No line class found for: ‘1-0:99.97.0(1)(0-0:96.7.19)(000101000001W)(2147483647s)’
16-12-23 16:08:13 dsmr_parser.parsers: No line class found for: '1-0:31.7.0(008
A)’
16-12-23 16:08:13 dsmr_parser.parsers: No line class found for: ‘!8B27^@’

Any ideas about those?

Try this for hiding devices: https://home-assistant.io/getting-started/customizing-devices/

It can happen from time to time a telegram fails to parse. Currently error correction is not implemented. Unless they occur a lot there should be no need to worry.