documentation can be found here: https://github.com/home-assistant/home-assistant.github.io/blob/next/source/_components/sensor.dsmr.markdown
Do I understand correctly from the documentation that the current usage is not reported?
It is reported…
sensor.power_consumption
Great work aequitas! Thanks!
Now I need to figure out a way to get daily usage out of Influx
The latest version 0.34 now contains DSMR: https://home-assistant.io/components/sensor.dsmr/
The hourly gas usage and tcp/ip support will probably be available next release.
Goodmorning all!
just intalled version .34 but i’m unable tot get the data in HA. manually search:
pi@raspberrypi:~ $ cu -l /dev/ttyUSB0 -s 115200 --parity=none
Connected.
/XMX5LGBBFFB231249762
1-3:0.2.8(42)
0-0:1.0.0(161204111652W)
0-0:96.1.1(4530303034303031363730313631383135)
1-0:1.8.1(001955.237*kWh)
1-0:2.8.1(000000.000*kWh)
1-0:1.8.2(002184.711*kWh)
1-0:2.8.2(000000.000*kWh)
0-0:96.14.0(0001)
1-0:1.7.0(00.438*kW)
1-0:2.7.0(00.000*kW)
0-0:96.7.21(00001)
0-0:96.7.9(00000)
1-0:99.97.0(0)(0-0:96.7.19)
1-0:32.32.0(00000)
1-0:32.36.0(00000)
0-0:96.13.1()
0-0:96.13.0()
1-0:31.7.0(002*A)
1-0:21.7.0(00.438*kW)
1-0:22.7.0(00.000*kW)
0-1:24.1.0(003)
0-1:96.1.0(4730303332353631323330323535363135)
0-1:24.2.1(161204110000W)(02661.821*m3)
!4DD7
~.
ìn the config file:
sensor slimme meter:
- platform: dsmr
tried it also with
sensor slimme meter:
- platform: dsmr
dsmr_version: 4
anyone an suggestion?
Can you check the home-assistant.log file for any error messages?
By default the 4 protocol is configured for Even parity. Can you test if you get data using that manually?
What output does this command give: dsmr_console --device /dev/ttyUSB0 --version 4
$ bash: dsmr_console: command not found
@fversteegen
what do you see in the frontend for the device under developer tools >> states?
is the state filled there?
I do see them,just made a group, but all info is unknown
16-12-04 12:00:36 homeassistant.components.sensor: Error while setting up platform dsmr
Traceback (most recent call last):
File "/home/homeassistant/.homeassistant/deps/serial/serialposix.py", line 265, in open
self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
PermissionError: [Errno 13] Permission denied: '/dev/ttyUSB0'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 145, in _async_setup_platform
entity_platform.async_add_entities, discovery_info
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/sensor/dsmr.py", line 107, in async_setup_platform
transport, _ = yield from hass.loop.create_task(dsmr)
File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
value = future.result()
File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
raise self._exception
File "/usr/lib/python3.4/asyncio/tasks.py", line 237, in _step
result = next(coro)
File "/usr/lib/python3.4/asyncio/coroutines.py", line 141, in coro
res = func(*args, **kw)
File "/home/homeassistant/.homeassistant/deps/serial_asyncio/__init__.py", line 409, in create_serial_connection
ser = serial.serial_for_url(*args, **kwargs)
File "/home/homeassistant/.homeassistant/deps/serial/__init__.py", line 88, in serial_for_url
instance.open()
File "/home/homeassistant/.homeassistant/deps/serial/serialposix.py", line 268, in open
raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
And a lot more lines
In there I see:
sensor.gas_consumption 148.433
Fixed the problem! i’m an hassbian user and i gave some permissions to the user: homeassistant, that did the job.
$ sudo usermod -a -G dialout homeassistant
and after that you need to reboot!
$ sudo reboot
Is it possible to run this sensor in HA together with a python script that reads my smartmeter at the same time?
Edit. Tried it, but that didn’t work. Either the script is working or HA is working, not both.
Btw. I had the same issue as Wilco. Perhaps it is better to add his solution to the documentation.
Sorry my bad, the command is not installed when the dsmr_parser
package is installed via home assistant. You can try to install it with pip3 install dsmr_parser==0.4
after that the command should run. This will tell us if the problem is in home assistant or in the underlying library to read the dsmr.
edit: see you already fixed it, nice.
Its a limitation of the linux serial port system that only one process can read a serial device at the same time. What would be possible is to export the data from home assistant to what the python script would previously do or use one of the recorder components home assistant provides.
Good work that it is now a official component!
Some thoughts however:
- Why stick to DSMR 2.2 as the standard setting? All meters that will be installed from now are >= DSMR 4. The 2.2 is old stuff that was installed like 3 years ago or so. Why not set DSMR 4 as the standard readout setting?
- CRC verification. For me this would have quite high priority. The DSMR 4 (or newer) meters provide this, why not use it? Without verification of the checksum, it is not the question when, but how many false readings you will receive into HASS.
However, this is not the fault of HASS, the author of the Python-module should add this (the sooner the better ) - No option to change the baudrate? DSMR2 uses 9600 baud, DSMR4 uses 115200. Or is this changed automatically when selecting the correct DSMR version of your meter?
Thanks for the explanation. I kept my python script for now, and used the influxdb sensor to read the data from the database. It’s probably easier to do it the other way around, by letting HA write to influxdb, but I had it set up already.
- I have a dsmr v2.2 device so I set it default for me
- I have been willing to add that feature but spent no time yet investigating the v4 spec about the crc. And also don’t have a device or data at my disposal to test it. This is better raised as an issue on the dsmr_parser project from Nigel Dokter which I used to implement this component (https://github.com/ndokter/dsmr_parser).
- Baud rate and serial settings is automatically changed based on protocol version: https://github.com/ndokter/dsmr_parser/blob/master/dsmr_parser/serial.py#L13-L31
@aequitas Just in you want to work on CRC correction
CRC is a CRC16 value calculated over the preceding characters in the data message (from “/” to “!” using the polynomial: x16+x15+x2+1). The value is represented as 4 hexadecimal characters (MSB first).
Am more than happy to share some extensive output with you, but will raise the request at DSMR within nonetheless (as soon as I figure out how to do that in Github )
Thanks Guys for the great work! this was one of the things that was missing in HA.
I have only one question is it possible to read out the different fases? I used this tool in VERA and there you could see witch fase uses how much.
Thanks so far!