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

The DSMR components is not yet adapted for DSMR5. Could you maybe try with the upstream library to verify if it works for you: https://github.com/ndokter/dsmr_parser

@NJB @rmeijs I added v5 support, could you please verify if this works as expected: https://github.com/home-assistant/home-assistant/pull/7535

You can test it by placing https://raw.githubusercontent.com/aequitas/home-assistant/dsmr5/homeassistant/components/sensor/dsmr.py in your custom_components/sensor folder in the configuration.

Thanks for the quick support! I placed dsmr.py in the folder, but this results in the error:

Traceback (most recent call last): File "/usr/lib/python3.4/asyncio/tasks.py", line 237, in _step result = next(coro) File "/home/homeassistant/.homeassistant/custom_components/sensor/dsmr.py", line 135, in connect_and_reconnect reader_factory()) File "/srv/homeassistant/lib/python3.4/site-packages/dsmr_parser/clients/protocol.py", line 50, in create_tcp_dsmr_reader dsmr_version, telegram_callback, loop=None) File "/srv/homeassistant/lib/python3.4/site-packages/dsmr_parser/clients/protocol.py", line 28, in create_dsmr_protocol dsmr_version) NotImplementedError: ('No telegram parser found for version: %s', '5')

I remember again this feature had more to it then just adding the option. Iā€™ll get back on this.

Can you grab the latest version of dsmr.py and try again.

Maybe a dumb question but i ask anyway :-).
I have DSMR activated through HA with platform: dsmr and my port to ttyUSB0 which is working.
In history i see (at this moment) only the m3 and kw because i enabled recording.

Now i see that youā€™re mentioning dsmr.py and place it in sensor directory. I manually created the custom_components\sensor directory and placed dsmr.py in there. But i donā€™t see that the .py file is used or activated.

So my (dumb) questions are

  • am i thinking in the right way
  • how can i check if the .py file is working
  • what is the advantage of the .py file with the feature DSMR enabled in HA

Thanks for the answer.

Using the custom_components you can inject your own components or overwrite components installed by HA. I mentioned it to NJB so he is able to test a new feature iā€™m working on. So there is no reason for you to use it :slight_smile:

1 Like

@NJB @rmeijs where you able to test the DSMR5 version of dsmr component? I would like to get it merged for the next release but I need to know if it works or not.

@aequitas,

Since I was on holiday I was not able to test.

I tested this morning and still it gives unknown values in the frontend. The HA log does not give any cluesā€¦ Any ideas how to debug?

2017-05-26 10:31:25 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.dsmr

Could you try and enable debug logging for the dsmr component?

logger:
  default: info
  logs:
    homeassistant.components.dsmr: debug

Yes, I already enabled debug in the logging for that component. The only results are:

2017-05-29 16:20:34 INFO (MainThread) [homeassistant.loader] Loaded sensor.dsmr from custom_components.sensor.dsmr
2017-05-29 16:20:36 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.dsmr

my bad, could you add this to logs as well:

dsmr_parser: debug

I tried, but it makes no differences in the logging.

Are there any non-dsmr log messages surrounding it? (wait a while for timeouts to resolve).
Do you still see the same error behaviour as before if you select dsmr4?
Could you try again with only dsmr config enabled and all debug on?

I adjusted the configuration file to only the DSMR sensor parts. Below the log file. Debug is on for all components. No differences in the log file when I select DSMR4.

2017-05-30 11:51:27 INFO (MainThread) [homeassistant.loader] Loaded frontend from homeassistant.components.frontend
2017-05-30 11:51:27 INFO (MainThread) [homeassistant.loader] Loaded api from homeassistant.components.api
2017-05-30 11:51:27 INFO (MainThread) [homeassistant.loader] Loaded http from homeassistant.components.http
2017-05-30 11:51:27 INFO (MainThread) [homeassistant.loader] Loaded websocket_api from homeassistant.components.websocket_api
2017-05-30 11:51:27 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=logger, service=set_level>
2017-05-30 11:51:27 INFO (MainThread) [homeassistant.core] Bus:Handling <Event component_loaded[L]: component=logger>
2017-05-30 11:51:27 INFO (MainThread) [homeassistant.setup] Setting up http
2017-05-30 11:51:27 INFO (MainThread) [homeassistant.core] Bus:Handling <Event component_loaded[L]: component=http>
2017-05-30 11:51:27 INFO (MainThread) [homeassistant.setup] Setting up websocket_api
2017-05-30 11:51:27 INFO (MainThread) [homeassistant.core] Bus:Handling <Event component_loaded[L]: component=websocket_api>
2017-05-30 11:51:27 INFO (MainThread) [homeassistant.setup] Setting up api
2017-05-30 11:51:27 INFO (MainThread) [homeassistant.core] Bus:Handling <Event component_loaded[L]: component=api>
2017-05-30 11:51:27 INFO (MainThread) [homeassistant.setup] Setting up frontend
2017-05-30 11:51:27 INFO (MainThread) [homeassistant.core] Bus:Handling <Event component_loaded[L]: component=frontend>
2017-05-30 11:51:27 INFO (MainThread) [homeassistant.loader] Loaded config from homeassistant.components.config
2017-05-30 11:51:27 INFO (MainThread) [homeassistant.loader] Loaded sensor from homeassistant.components.sensor
2017-05-30 11:51:27 INFO (MainThread) [homeassistant.loader] Loaded sensor.dsmr from custom_components.sensor.dsmr
2017-05-30 11:51:27 INFO (MainThread) [homeassistant.setup] Setting up sensor
2017-05-30 11:51:27 INFO (MainThread) [homeassistant.loader] Loaded group from homeassistant.components.group
2017-05-30 11:51:27 INFO (MainThread) [homeassistant.setup] Setting up group
2017-05-30 11:51:27 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: new_state=<state group.meter_readings=unknown; entity_id=('sensor.power_consumption_low', 'sensor.power_consumption_normal', 'sensor.power_production_low', 'sensor.power_production_normal', 'sensor.gas_consumption'), order=0, friendly_name=Meter readings @ 2017-05-30T11:51:27.948882+02:00>, entity_id=group.meter_readings, old_state=None>
2017-05-30 11:51:27 INFO (MainThread) [homeassistant.setup] Setting up config
2017-05-30 11:51:27 INFO (MainThread) [homeassistant.loader] Loaded config.hassbian from homeassistant.components.config.hassbian
2017-05-30 11:51:28 INFO (MainThread) [homeassistant.loader] Loaded config.core from homeassistant.components.config.core
2017-05-30 11:51:28 INFO (MainThread) [homeassistant.core] Bus:Handling <Event component_loaded[L]: component=config.core>
2017-05-30 11:51:28 INFO (MainThread) [homeassistant.loader] Loaded config.automation from homeassistant.components.config.automation
2017-05-30 11:51:28 INFO (MainThread) [homeassistant.core] Bus:Handling <Event component_loaded[L]: component=config.automation>
2017-05-30 11:51:28 INFO (MainThread) [homeassistant.loader] Loaded config.group from homeassistant.components.config.group
2017-05-30 11:51:28 INFO (MainThread) [homeassistant.core] Bus:Handling <Event component_loaded[L]: component=config.group>
2017-05-30 11:51:28 INFO (MainThread) [homeassistant.core] Bus:Handling <Event component_loaded[L]: component=config>
2017-05-30 11:51:28 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=group, service=set_visibility>
2017-05-30 11:51:28 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=group, service=reload>
2017-05-30 11:51:28 INFO (MainThread) [homeassistant.core] Bus:Handling <Event component_loaded[L]: component=group>
2017-05-30 11:51:28 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.dsmr
2017-05-30 11:51:28 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: new_state=<state sensor.power_consumption_normal=unknown; icon=mdi:flash, friendly_name=Power Consumption (normal) @ 2017-05-30T11:51:28.580746+02:00>, entity_id=sensor.power_consumption_normal, old_state=None>
2017-05-30 11:51:28 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: new_state=<state sensor.power_tariff=unknown; icon=mdi:flash, friendly_name=Power Tariff @ 2017-05-30T11:51:28.584247+02:00>, entity_id=sensor.power_tariff, old_state=None>
2017-05-30 11:51:28 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: new_state=<state sensor.power_production_low=unknown; icon=mdi:flash, friendly_name=Power Production (low) @ 2017-05-30T11:51:28.588221+02:00>, entity_id=sensor.power_production_low, old_state=None>
2017-05-30 11:51:28 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: new_state=<state sensor.power_consumption=unknown; icon=mdi:flash, friendly_name=Power Consumption @ 2017-05-30T11:51:28.590834+02:00>, entity_id=sensor.power_consumption, old_state=None>
2017-05-30 11:51:28 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: new_state=<state sensor.hourly_gas_consumption=unknown; icon=mdi:fire, friendly_name=Hourly Gas Consumption @ 2017-05-30T11:51:28.593514+02:00>, entity_id=sensor.hourly_gas_consumption, old_state=None>
2017-05-30 11:51:28 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: new_state=<state sensor.gas_consumption=unknown; icon=mdi:fire, friendly_name=Gas Consumption @ 2017-05-30T11:51:28.596258+02:00>, entity_id=sensor.gas_consumption, old_state=None>
2017-05-30 11:51:28 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: new_state=<state sensor.power_consumption_low=unknown; icon=mdi:flash, friendly_name=Power Consumption (low) @ 2017-05-30T11:51:28.599064+02:00>, entity_id=sensor.power_consumption_low, old_state=None>
2017-05-30 11:51:28 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: new_state=<state sensor.power_production_normal=unknown; icon=mdi:flash, friendly_name=Power Production (normal) @ 2017-05-30T11:51:28.601798+02:00>, entity_id=sensor.power_production_normal, old_state=None>
2017-05-30 11:51:28 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: new_state=<state sensor.power_production=unknown; icon=mdi:flash, friendly_name=Power Production @ 2017-05-30T11:51:28.604589+02:00>, entity_id=sensor.power_production, old_state=None>
2017-05-30 11:51:28 INFO (MainThread) [homeassistant.core] Bus:Handling <Event component_loaded[L]: component=sensor>
2017-05-30 11:51:28 INFO (MainThread) [homeassistant.bootstrap] Home Assistant initialized in 2.69s
2017-05-30 11:51:28 INFO (MainThread) [homeassistant.core] Starting Home Assistant core loop
2017-05-30 11:51:28 INFO (MainThread) [homeassistant.core] Starting Home Assistant
2017-05-30 11:51:28 INFO (MainThread) [homeassistant.core] Bus:Handling <Event homeassistant_start[L]>
2017-05-30 11:51:28 INFO (MainThread) [homeassistant.core] Timer:starting
2017-05-30 11:51:29 INFO (MainThread) [homeassistant.components.http] Serving /api/websocket to 192.168.2.61 (auth: True)
2017-05-30 11:51:29 DEBUG (MainThread) [homeassistant.components.websocket_api] WS 1984538544: Connected 
2017-05-30 11:51:29 DEBUG (MainThread) [homeassistant.components.websocket_api] WS 1984538544: Received {'id': 2, 'type': 'subscribe_events', 'event_type': 'state_changed'}
2017-05-30 11:51:29 DEBUG (MainThread) [homeassistant.components.websocket_api] WS 1984538544: Received {'id': 3, 'type': 'subscribe_events', 'event_type': 'component_loaded'}
2017-05-30 11:51:29 DEBUG (MainThread) [homeassistant.components.websocket_api] WS 1984538544: Received {'id': 4, 'type': 'subscribe_events', 'event_type': 'service_registered'}
2017-05-30 11:51:29 DEBUG (MainThread) [homeassistant.components.websocket_api] WS 1984538544: Received {'id': 5, 'type': 'subscribe_events', 'event_type': 'service_removed'}
2017-05-30 11:51:29 DEBUG (MainThread) [homeassistant.components.websocket_api] WS 1984538544: Received {'id': 6, 'type': 'get_states'}
2017-05-30 11:51:29 DEBUG (MainThread) [homeassistant.components.websocket_api] WS 1984538544: Sending {'success': True, 'id': 2, 'result': None, 'type': 'result'}
2017-05-30 11:51:29 DEBUG (MainThread) [homeassistant.components.websocket_api] WS 1984538544: Sending {'success': True, 'id': 3, 'result': None, 'type': 'result'}
2017-05-30 11:51:29 DEBUG (MainThread) [homeassistant.components.websocket_api] WS 1984538544: Sending {'success': True, 'id': 4, 'result': None, 'type': 'result'}
2017-05-30 11:51:29 DEBUG (MainThread) [homeassistant.components.websocket_api] WS 1984538544: Sending {'success': True, 'id': 5, 'result': None, 'type': 'result'}
2017-05-30 11:51:29 DEBUG (MainThread) [homeassistant.components.websocket_api] WS 1984538544: Sending {'success': True, 'id': 6, 'result': [<state sensor.power_consumption_low=unknown; icon=mdi:flash, friendly_name=Power Consumption (low) @ 2017-05-30T11:51:28.599064+02:00>, <state sensor.power_tariff=unknown; icon=mdi:flash, friendly_name=Power Tariff @ 2017-05-30T11:51:28.584247+02:00>, <state sensor.power_consumption=unknown; icon=mdi:flash, friendly_name=Power Consumption @ 2017-05-30T11:51:28.590834+02:00>, <state sensor.power_production=unknown; icon=mdi:flash, friendly_name=Power Production @ 2017-05-30T11:51:28.604589+02:00>, <state sensor.power_consumption_normal=unknown; icon=mdi:flash, friendly_name=Power Consumption (normal) @ 2017-05-30T11:51:28.580746+02:00>, <state sensor.power_production_normal=unknown; icon=mdi:flash, friendly_name=Power Production (normal) @ 2017-05-30T11:51:28.601798+02:00>, <state sensor.gas_consumption=unknown; icon=mdi:fire, friendly_name=Gas Consumption @ 2017-05-30T11:51:28.596258+02:00>, <state group.meter_readings=unknown; entity_id=('sensor.power_consumption_low', 'sensor.power_consumption_normal', 'sensor.power_production_low', 'sensor.power_production_normal', 'sensor.gas_consumption'), order=0, friendly_name=Meter readings @ 2017-05-30T11:51:27.948882+02:00>, <state sensor.hourly_gas_consumption=unknown; icon=mdi:fire, friendly_name=Hourly Gas Consumption @ 2017-05-30T11:51:28.593514+02:00>, <state sensor.power_production_low=unknown; icon=mdi:flash, friendly_name=Power Production (low) @ 2017-05-30T11:51:28.588221+02:00>], 'type': 'result'}
2017-05-30 11:51:29 DEBUG (MainThread) [homeassistant.components.websocket_api] WS 1984538544: Received {'id': 7, 'type': 'get_config'}
2017-05-30 11:51:29 DEBUG (MainThread) [homeassistant.components.websocket_api] WS 1984538544: Received {'id': 8, 'type': 'get_panels'}
2017-05-30 11:51:29 DEBUG (MainThread) [homeassistant.components.websocket_api] WS 1984538544: Received {'id': 9, 'type': 'get_services'}
2017-05-30 11:51:29 DEBUG (MainThread) [homeassistant.components.websocket_api] WS 1984538544: Sending {'success': True, 'id': 7, 'result': {'components': {'sensor', 'http', 'api', 'config.group', 'group', 'config.core', 'logger', 'config.automation', 'sensor.dsmr', 'config', 'frontend', 'websocket_api'}, 'location_name': 'Home', 'config_dir': '/home/homeassistant/.homeassistant', 'longitude': 4.6678, 'latitude': 52.7223, 'elevation': 0, 'unit_system': {'temperature': 'ƂĀ°C', 'length': 'km', 'volume': 'L', 'mass': 'g'}, 'version': '0.45.1', 'time_zone': 'Europe/Amsterdam'}, 'type': 'result'}
2017-05-30 11:51:29 DEBUG (MainThread) [homeassistant.components.websocket_api] WS 1984538544: Sending {'success': True, 'id': 8, 'result': {'config': {'url': '/frontend/panels/config-59d9eb28758b497a4d9b2428f978b9b1.html', 'component_name': 'config', 'title': 'Configuration', 'icon': 'mdi:settings', 'url_path': 'config'}, 'map': {'url': '/frontend/panels/map-31c592c239636f91e07c7ac232a5ebc4.html', 'component_name': 'map', 'title': 'Map', 'icon': 'mdi:account-location', 'url_path': 'map'}, 'dev-info': {'component_name': 'dev-info', 'url': '/frontend/panels/dev-info-61610e015a411cfc84edd2c4d489e71d.html', 'url_path': 'dev-info'}, 'dev-template': {'component_name': 'dev-template', 'url': '/frontend/panels/dev-template-567fbf86735e1b891e40c2f4060fec9b.html', 'url_path': 'dev-template'}, 'dev-event': {'component_name': 'dev-event', 'url': '/frontend/panels/dev-event-2db9c218065ef0f61d8d08db8093cad2.html', 'url_path': 'dev-event'}, 'dev-state': {'component_name': 'dev-state', 'url': '/frontend/panels/dev-state-d70314913b8923d750932367b1099750.html', 'url_path': 'dev-state'}, 'dev-service': {'component_name': 'dev-service', 'url': '/frontend/panels/dev-service-415552027cb083badeff5f16080410ed.html', 'url_path': 'dev-service'}}, 'type': 'result'}
2017-05-30 11:51:29 DEBUG (MainThread) [homeassistant.components.websocket_api] WS 1984538544: Sending {'success': True, 'id': 9, 'result': {'homeassistant': {'toggle': {'description': '', 'fields': {}}, 'reload_core_config': {'description': '', 'fields': {}}, 'check_config': {'description': '', 'fields': {}}, 'restart': {'description': '', 'fields': {}}, 'stop': {'description': '', 'fields': {}}, 'turn_on': {'description': '', 'fields': {}}, 'turn_off': {'description': '', 'fields': {}}}, 'logger': {'set_level': {'description': 'Set log level for components.', 'fields': {}}}, 'group': {'set_visibility': {'description': 'Hide or show a group', 'fields': OrderedDict([('entity_id', OrderedDict([('description', 'Name(s) of entities to set value'), ('example', 'group.travel')])), ('visible', OrderedDict([('description', 'True if group should be shown or False if it should be hidden.'), ('example', True)]))])}, 'reload': {'description': 'Reload group configuration.', 'fields': {}}}, 'persistent_notification': {'create': {'description': 'Show a notification in the frontend', 'fields': OrderedDict([('message', OrderedDict([('description', 'Message body of the notification. [Templates accepted]'), ('example', 'Please check your configuration.yaml.')])), ('title', OrderedDict([('description', 'Optional title for your notification. [Optional, Templates accepted]'), ('example', 'Test notification')])), ('notification_id', OrderedDict([('description', 'Target ID of the notification, will replace a notification with the same Id. [Optional]'), ('example', 1234)]))])}}}, 'type': 'result'}

Can you connect to the DSMR device outside of HASS to receive telegrams (with eg, terminal or another client) and what settings do you use? Maybe the configured settings for DSMR5 (https://github.com/ndokter/dsmr_parser/blob/master/dsmr_parser/clients/settings.py#L14-L22) donā€™t work for your device.

Using wget I get the following results:

/ISK5\2M550E-1012

1-3:0.2.8(50)
0-0:1.0.0(170604203021S)
0-0:96.1.1(4530303433303036383737323231393137)
1-0:1.8.1(000050.781*kWh)
1-0:1.8.2(000052.404*kWh)
1-0:2.8.1(000000.000*kWh)
1-0:2.8.2(000000.000*kWh)
0-0:96.14.0(0001)
1-0:1.7.0(00.104*kW)
1-0:2.7.0(00.000*kW)
0-0:96.7.21(00007)
0-0:96.7.9(00003)
1-0:99.97.0(1)(0-0:96.7.19)(170327090020S)(0000000189*s)
1-0:32.32.0(00000)
1-0:32.36.0(00001)
0-0:96.13.0()
1-0:32.7.0(229.7*V)
0-0:96.13.0()
1-0:32.7.0(229.7*V)
1-0:31.7.0(000*A)
1-0:21.7.0(00.103*kW)
1-0:22.7.0(00.000*kW)
0-1:24.1.0(003)
0-1:96.1.0(4730303339303031373031373034313137)
0-1:24.2.1(170604203006S)(00028.717*m3)
!54109

However, in settings.py of the DSMR parser, v5 is not included. Does that makes sense?

How do you use wget to read the serial line? Or do you have some device in between? I donā€™t have a dsmr5 device to test and made the assumption that the DSMR4 settings would work as well but have no information to go off. Thatā€™s why Iā€™m asking for testers. What serial settings work for you? And do they match with the DSMR4 settings in settings.py?

I know, just trying to help in identifying the cause of the errors. Glad I can help.

I have the ISKRA AM550 (DSMR5) and use P1 wifi gateway from http://www.esp8266thingies.nl/wp/. I use the protocol and controller as described here (Domoticz HTTP).

The settings I use are the following:

The one thing that might be different is the bytesizeā€¦?

Link is not workingā€¦ ā€œError 404 - Pagina niet gevonden.ā€