esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
291 stars 34 forks source link

DSMR: Gas data does not show up #2638

Open Cryonic90 opened 2 years ago

Cryonic90 commented 2 years ago

The problem

I'm using an Wemos D1 mini and all of the other data shows up, but only the gas data does not. I've tried playing around with the mbus_id, but this doesn't seem to work for me. Hooking up an FTDI to a PC and opening the serial port shows this: 1-3:0.2.8(42) 0-0:1.0.0(211025122251S) 0-0:96.1.1(4530303330303033313730343838313135) 1-0:1.8.1(008537.641*kWh) 1-0:1.8.2(007069.927*kWh) 1-0:2.8.1(001044.662*kWh) 1-0:2.8.2(002515.444*kWh) 0-0:96.14.0(0002) 1-0:1.7.0(00.370*kW) 1-0:2.7.0(00.000*kW) 0-0:96.7.21(00013) 0-0:96.7.9(00009) 1-0:99.97.0(9)(0-0:96.7.19)(210324194538W)(0000004159*s)(190603121040S)(0000000280*s)(190517110331S)(0000000230*s)(181205104105W)(0000002129*s)(160726165207S)(0000000470*s)(160621150145S)(0000007990*s)(160525073504S)(0000000372*s)(160421143231S)(0000000548*s)(160420165926S)(0000000604*s) 1-0:32.32.0(00000) 1-0:52.32.0(00002) 1-0:72.32.0(00004) 1-0:32.36.0(00000) 1-0:52.36.0(00000) 1-0:72.36.0(00000) 0-0:96.13.1() 0-0:96.13.0() 1-0:31.7.0(002*A) 1-0:51.7.0(000*A) 1-0:71.7.0(001*A) 1-0:21.7.0(00.140*kW) 1-0:41.7.0(00.003*kW) 1-0:61.7.0(00.225*kW) 1-0:22.7.0(00.000*kW) 1-0:42.7.0(00.000*kW) 1-0:62.7.0(00.000*kW) 0-2:24.1.0(003) 0-2:96.1.0(4730303332353631323636373632343136) 0-2:24.2.1(211025120000S)(04034.144*m3) !1EE3 From this I can see that the mbus should be set to 2 (which I did), but still nothing.

Which version of ESPHome has the issue?

2021.10.2

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

core-2021.10.6

What platform are you using?

ESP8266

Board

Wemos D1 mini

Component causing the issue

dsmr

Example YAML snippet

# Example configuration entry
dsmr:
  gas_mbus_id: 2

Anything in the logs that might be useful for us?

No response

Additional information

No response

probot-esphome[bot] commented 2 years ago

Hey there @glmnet, @zuidwijk, mind taking a look at this issue as it has been labeled with an integration (dsmr) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

miclnl commented 2 years ago

Same here using slimmelezer

09:41:16][D][uart_debug:152]: <<< "/KFM5KAIFA-METER\r\n"
[09:41:16][D][uart_debug:152]: <<< "\r\n"
[09:41:16][D][uart_debug:152]: <<< "1-3:0.2.8(42)\r\n"
[09:41:16][D][uart_debug:152]: <<< "0-0:1.0.0(211107094138W)\r\n"
[09:41:17][D][uart_debug:152]: <<< "0-0:96.1.1(4530303237303030303036323835363136)\r\n"
[09:41:17][D][uart_debug:152]: <<< "1-0:1.8.1(004946.350*kWh)\r\n"
[09:41:17][D][uart_debug:152]: <<< "1-0:1.8.2(005483.286*kWh)\r\n"
[09:41:17][D][uart_debug:152]: <<< "1-0:2.8.1(000000.000*kWh)\r\n"
[09:41:17][D][uart_debug:152]: <<< "1-0:2.8.2(000000.000*kWh)\r\n"
[09:41:17][D][uart_debug:152]: <<< "0-0:96.14.0(0001)\r\n"
[09:41:17][D][uart_debug:152]: <<< "1-0:1.7.0(00.765*kW)\r\n"
[09:41:17][D][uart_debug:152]: <<< "1-0:2.7.0(00.000*kW)\r\n"
[09:41:17][D][uart_debug:152]: <<< "0-0:96.7.21(00000)\r\n"
[09:41:17][D][uart_debug:152]: <<< "0-0:96.7.9(00000)\r\n"
[09:41:17][D][uart_debug:152]: <<< "1-0:99.97.0(1)(0-0:96.7.19)(000101000001W)(2147483647*s)\r\n"
[09:41:17][D][uart_debug:152]: <<< "1-0:32.32.0(00000)\r\n"
[09:41:17][D][uart_debug:152]: <<< "1-0:32.36.0(00000)\r\n"
[09:41:17][D][uart_debug:152]: <<< "0-0:96.13.1()\r\n"
[09:41:17][D][uart_debug:152]: <<< "0-0:96.13.0()\r\n"
[09:41:17][D][uart_debug:152]: <<< "1-0:31.7.0(003*A)\r\n"
[09:41:17][D][uart_debug:152]: <<< "1-0:21.7.0(00.780*kW)\r\n"
[09:41:17][D][uart_debug:152]: <<< "1-0:22.7.0(00.000*kW)\r\n"
[09:41:17][D][uart_debug:152]: <<< "0-2:24.1.0(003)\r\n"
[09:41:17][D][uart_debug:152]: <<< "0-2:96.1.0(4730303332353631323932353436313138)\r\n"
[09:41:17][D][uart_debug:152]: <<< "0-2:24.2.1(211107090000W)(03073.484*m3)\r\n"
[09:41:17][D][uart_debug:152]: <<< "!D7CD\r\n"
[09:41:17][D][sensor:113]: 'Energy Consumed Tariff 1': Sending state 4946.35010 kWh with 3 decimals of accuracy
[09:41:17][D][sensor:113]: 'Energy Consumed Tariff 2': Sending state 5483.28613 kWh with 3 decimals of accuracy
[09:41:17][D][sensor:113]: 'Energy Produced Tariff 1': Sending state 0.00000 kWh with 3 decimals of accuracy
[09:41:17][D][sensor:113]: 'Energy Produced Tariff 2': Sending state 0.00000 kWh with 3 decimals of accuracy
[09:41:17][D][sensor:113]: 'Power Consumed': Sending state 0.76500 kW with 3 decimals of accuracy
[09:41:17][D][sensor:113]: 'Power Produced': Sending state 0.00000 kW with 3 decimals of accuracy
[09:41:17][D][sensor:113]: 'Electricity Failures': Sending state 0.00000  with 0 decimals of accuracy
[09:41:17][D][sensor:113]: 'Long Electricity Failures': Sending state 0.00000  with 0 decimals of accuracy
[09:41:17][D][sensor:113]: 'Current Phase 1': Sending state 3.00000 A with 1 decimals of accuracy
[09:41:17][D][sensor:113]: 'Power Consumed Phase 1': Sending state 0.78000 kW with 3 decimals of accuracy
[09:41:17][D][sensor:113]: 'Power Produced Phase 1': Sending state 0.00000 kW with 3 decimals of accuracy
[09:41:17][D][text_sensor:067]: 'DSMR Identification': Sending state 'KFM5KAIFA-METER'
[09:41:17][D][text_sensor:067]: 'DSMR Version': Sending state '42'
text_sensor:
  gas_delivered_text:

is also empty

mmakaay commented 2 years ago

I've looked into this issue a while ago, and the problem is that ESPHome does add a define for overriding the gas MBUS I'd to the defines.h file, however that include is invisible for the external Dsmr library.

That library needs a way to set the id via its API (like it was done for disabling CRC checking), or the library needs to be incorporated fully into the ESPHome code.

Robbie-65 commented 2 years ago

Hi, Exactly the same problem here. My raw gas sensor shows: image

I used a workarround to get the sensor in Home Assistant, but it would be better to have the gas sensor directly out of the reader. I created a template with a regular expression, that seems to do the trick:

- platform: template sensors: gasmeter: value_template: '{{ states("sensor.gas_delivered_raw") | regex_findall_index("\((\d*\.?\d*)\)$") }}' friendly_name: gasmeter unit_of_measurement: m³ icon_template: mdi:fire device_class: gas

image

johanneswilkens commented 2 years ago

I have the same issue as @Robbie-65 has, what I get is this: (220101190000)(00)(60)(1)(0-1:24.2.1)(m3)(29012.910) so the last value is the gas value in m3, maybe this formatting is because of an older DSMR version. Native support for all DSMR versions would be nice, maybe with a config like this:

uart:
  baud_rate: 9600
  data_bits: 7
  parity: NONE
  stop_bits: 1

dsmr:
  crc_check: false
  version: 2.2 # as optional config variable, defaults to 5.0 so its not a breaking change and it still works out of the box for most new meters

sensor:
  - platform: dsmr
    energy_delivered_tariff1:
      name: dsmr_energy_delivered_tariff1
    any other supported value you want to add:
      name: your fancy name here

I think this should be useful for a lot of people. It's too bad there is no documentation of the code and there are no comments in it about how things work, so it's almost impossible for me to reverse engineer a integration it and add try to add extra functionalities and test it myself...

joostvkempen commented 2 years ago

Yesterday my electricity meter was replaced, since then gas meter values not showing. parsing error in HA, seems to be same issue as described here. The gas meter was not changed, so probably connected to wrong mbus channel....

ractoc commented 2 years ago

I'm having the same problem. I'm running the latest firmware on the slimmelezer. But in HA I only see two gas related sensors, gas consumed and gas consume belgium, both are at 0 all the time. Unlike most of the people who have problems wit this, I'm at DSMR 5. I don't have any raw or text sensors related to gas, so I don't think I can use those to read anything. Or I might need to add the sensors to tha YAML somewhere first to make them availlable??

Cryonic90 commented 2 years ago

Updated to the last beta today and I see that the gas consumption now shows up in the log. Seems to work now! :)

paulvt commented 2 years ago

Same for me. I did have to add gas_mbus_id: 2 to my slimmemeter.yaml. So this is possible now, but, since it is not really auto-detectable, it might need to be mentioned in the docs more clearly. Also for the slimmelezer product I guess.

nagtegaal commented 2 years ago

Hi, Exactly the same problem here. My raw gas sensor shows: image

I used a workarround to get the sensor in Home Assistant, but it would be better to have the gas sensor directly out of the reader. I created a template with a regular expression, that seems to do the trick:

- platform: template sensors: gasmeter: value_template: '{{ states("sensor.gas_delivered_raw") | regex_findall_index("\((\d*\.?\d*)\)$") }}' friendly_name: gasmeter unit_of_measurement: m³ icon_template: mdi:fire device_class: gas

image

@Robbie-65 : Where and how did you add this sensor in HA? I have the exact same info in my sensor.gas_delivered when using Zuidwijks Slimmemeter, and a DSMR 2.2 meter. Quite a newbie to HA still...

kurniawan77 commented 1 year ago

Hi, Exactly the same problem here. My raw gas sensor shows: image

I used a workarround to get the sensor in Home Assistant, but it would be better to have the gas sensor directly out of the reader. I created a template with a regular expression, that seems to do the trick:

- platform: template sensors: gasmeter: value_template: '{{ states("sensor.gas_delivered_raw") | regex_findall_index("\((\d*\.?\d*)\)$") }}' friendly_name: gasmeter unit_of_measurement: m³ icon_template: mdi:fire device_class: gas

image

Works very well 👍🏽.