esphome / issues

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

Wrong scaler applied in SML parser #4349

Open micw opened 1 year ago

micw commented 1 year ago

The problem

I'm using the SML component as described in the docs. I have defined the following sensor:

sensor:
  - platform: sml
    sml_id: sml0
    name: "powerTotal"
    obis_code: "1-0:16.7.0"
    unit_of_measurement: W
    accuracy_decimals: 2
    device_class: energy
#    filters:
#      - multiply: 0.01

The problem is that I have to enable the scaler (0.01) but the meter already sends in Watt. So no scaler should be needed here.

Which version of ESPHome has the issue?

esphome-2023.3.0-1

What type of installation are you using?

pip

Which version of Home Assistant has the issue?

none, it's a esphome issue

What platform are you using?

ESP8266

Board

D1 Mini

Component causing the issue

smp

Example YAML snippet

sensor:
  - platform: sml
    sml_id: sml0
    name: "powerTotal"
    obis_code: "1-0:16.7.0"
    unit_of_measurement: W
    accuracy_decimals: 2
    device_class: energy
#    filters:
#      - multiply: 0.01

Anything in the logs that might be useful for us?

[22:43:09][D][uart_debug:114]: <<< 1B:1B:1B:1B:01:01:01:01:76:05:12:F5:54:8B:62:00:62:00:72:65:00:00:01:01:76:01:01:07:65:42:5A:44:44:33:0B:09:01:45:42:5A:01:00:09:1F:14:01:01:63:85:AA:00:76:05:12:F5:54:8C:62:00:62:00:72:65:00:00:07:01:77:01:0B:09:01:45:42:5A:01:00:09:1F:14:01:72:62:01:65:05:F5:9A:4A:7A:77:07:81:81:C7:82:03:FF:01:01:01:01:04:45:42:5A:01:77:07:01:00:00:00:09:FF:01:01:01:01:0B:09:01:45:42:5A:01:00:09:1F:14:01:77:07:01:00:01:08:00:FF:64:01:01:80:01:62:1E:52:FB:69:00:00:02:AC:1A:8A:05:9B:01:77
[22:43:10][D][sensor:126]: 'powerTotal': Sending state 393692.00000 W with 2 decimals of accuracy
[22:43:10][D][sml:065]: OBIS info:
[22:43:10][D][sml:071]:   (090145425a0100091f14) 129-129:199.130.3 [0x45425a]
[22:43:10][D][sml:071]:   (090145425a0100091f14) 1-0:0.0.9 [0x090145425a0100091f14]
[22:43:10][D][sml:071]:   (090145425a0100091f14) 1-0:1.8.0 [0x000002ac1a8bb0c9]
[22:43:10][D][sml:071]:   (090145425a0100091f14) 1-0:1.8.1 [0x000002ac147130c9]
[22:43:10][D][sml:071]:   (090145425a0100091f14) 1-0:1.8.2 [0x00000000061a8000]
[22:43:10][D][sml:071]:   (090145425a0100091f14) 1-0:2.8.0 [0x0000000021eca426]
[22:43:10][D][sml:071]:   (090145425a0100091f14) 1-0:16.7.0 [0x000601dc]
[22:43:10][D][sml:071]:   (090145425a0100091f14) 1-0:36.7.0 [0x00050416]
[22:43:10][D][sml:071]:   (090145425a0100091f14) 1-0:56.7.0 [0x0000a6bc]
[22:43:10][D][sml:071]:   (090145425a0100091f14) 1-0:76.7.0 [0x0000570a]

Additional information

No response

github-actions[bot] commented 11 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

micw commented 11 months ago

Still an issue.

micw commented 7 months ago

I digged a bit deeper, the issue is in SmlSensor.c. Thing is that obis_info.scaler is just ignored.