Comments (29)
I can confirm running on ESP32-CAM and ESP32 D1 Mini (random manufacturer from amazon).
connected rx,tx,3.3v and gnd to a mikroe m-bus clicker slave.
The ESP32 node mcu from AZ was only able to receive data when 3.3v was not connected but still unstable.
I don't realy understand how this can happen as the code should log an error and drop the invalid payload.
As the error did not occure at my home i did no further investigation.
from esphome-dlms-meter.
Info: Found a similar problem here:
home-assistant/core#57551
from esphome-dlms-meter.
I had this happen once last year, unfortunately I didn't log the values sent by the smart meter at the time it happened so I'm not sure if it's the smart meter that sent invalid data or if the value of the smart meter rolled over somehow.
If it happens again I will add a limiter to the values the smart meter can send and ignore unrealistic values.
Unfortunately deleting values from the Home Assistant energy database is also a pain.
from esphome-dlms-meter.
Thanks to home assistant 2022.4 you can now easily edit the malformed value directly from dev tools.
Will check if the above issue is repeating and report back. sadly I can't code :(
Would be an improvement in general to have a limit for unrealistic values. Would be your Testkaninchen :)
from esphome-dlms-meter.
sadly again :(
Is it okay for you to apply the limit?
Thank you - LG aus Höchst
from esphome-dlms-meter.
Hey There,
have now gathered some logs:
Seems that the smartmeter is sending wrong data sometimes.
EDIT: Sadly the yaml code also didn't work.
Will report back.
Greetings
from esphome-dlms-meter.
So... i have now gathered more logs, seeing that the smartmeter is pushing wrong values from time to time.
Here's an excerpt from the logs:
[20:10:30][D][espdm:042]: Handling packet [20:10:30][V][espdm:455]: 68 FA FA 68 53 FF 00 01 67 DB 08 4B 46 4D 10 20 01 D9 16 82 01 55 21 00 01 17 94 52 DC 7D C5 7F 68 AB 36 34 98 21 4A F7 A1 7D 6C C3 83 FE 47 BE E6 6F C4 81 B4 95 76 91 7D 66 E5 72 01 F3 EA 53 41 66 8F E4 33 47 F9 8E 73 33 92 05 13 E2 66 EC E1 17 90 3C 90 A6 9B 1C B3 C4 5F 48 59 4D 97 75 85 80 CC 64 FF 2F 87 82 4B B6 41 F4 C8 A1 F7 7E E4 00 30 52 E5 A5 B4 CE 8A 48 59 B1 1C 54 BC B7 7B 99 83 89 FA 1B 2F 19 E7 11 15 9B 96 D4 B3 EE 8C 99 62 8F AE 6D 13 23 74 14 70 2D 8C 68 57 21 FE AE F0 C4 AA 87 B3 65 1E BF BA 9F A3 5A 57 CE 24 F5 11 69 14 BD 84 AB 51 19 A0 C2 B3 3F 48 1D 95 A4 A2 07 0E 9A B6 52 49 C3 E5 79 A7 64 F6 D9 C5 FD 03 97 9C 84 06 63 9F 68 3C AA DA EC 71 27 DB 6B 50 3E 09 49 E6 9F 23 F7 0D 0A 15 E1 3C A4 6B DF 3A D7 4D 8B 05 91 2A 74 60 2F 5A 65 EB 16 68 72 72 68 53 FF 11 01 67 E1 E8 B2 4F 79 89 25 83 83 FB B7 5A 52 BD 26 60 3B 6B 32 D0 A1 C8 4B 13 8C 92 49 1A 45 9A DE 7A 50 7B AC E1 71 AA 4E 65 8B A5 03 48 89 27 13 0E 07 94 30 5B BD 91 B4 2B 74 D1 48 3C 93 FD 48 FD AE 26 6F 80 51 5F 53 0F 68 91 05 CE 5E 8D BB A2 5E C2 5D F1 13 91 32 A7 E5 B4 F9 CA 1B E9 88 8F AB 82 44 B1 58 12 AF E6 BB 99 53 66 F0 56 16 [20:10:30][V][text_sensor:016]: 'smartmeter_timestamp': Received new state 2022-04-13T20:10:30Z [20:10:30][D][text_sensor:067]: 'smartmeter_timestamp': Sending state '2022-04-13T20:10:30Z' [20:10:30][V][mqtt:405]: Publish(topic='smartmeter/sensor/smartmeter_timestamp/state' payload='2022-04-13T20:10:30Z' retain=1) [20:10:30][V][sensor:074]: 'smartmeter_voltage_l1': Received new state 225.899994 [20:10:30][D][sensor:125]: 'smartmeter_voltage_l1': Sending state 225.89999 V with 1 decimals of accuracy [20:10:30][V][mqtt:405]: Publish(topic='smartmeter/sensor/smartmeter_voltage_l1/state' payload='225.9' retain=1) [20:10:30][V][sensor:074]: 'smartmeter_voltage_l2': Received new state 228.899994 [20:10:30][D][sensor:125]: 'smartmeter_voltage_l2': Sending state 228.89999 V with 1 decimals of accuracy [20:10:30][V][mqtt:405]: Publish(topic='smartmeter/sensor/smartmeter_voltage_l2/state' payload='228.9' retain=1) [20:10:30][V][sensor:074]: 'smartmeter_voltage_l3': Received new state 227.600006 [20:10:30][D][sensor:125]: 'smartmeter_voltage_l3': Sending state 227.60001 V with 1 decimals of accuracy [20:10:30][V][mqtt:405]: Publish(topic='smartmeter/sensor/smartmeter_voltage_l3/state' payload='227.6' retain=1) [20:10:30][V][sensor:074]: 'smartmeter_current_l1': Received new state 12.020000 [20:10:30][D][sensor:125]: 'smartmeter_current_l1': Sending state 12.02000 A with 1 decimals of accuracy [20:10:30][V][mqtt:405]: Publish(topic='smartmeter/sensor/smartmeter_current_l1/state' payload='12.0' retain=1) [20:10:30][V][sensor:074]: 'smartmeter_active_power_plus': Received new state 3196.000000 [20:10:30][D][sensor:125]: 'smartmeter_active_power_plus': Sending state 3196.00000 W with 1 decimals of accuracy [20:10:30][V][mqtt:405]: Publish(topic='smartmeter/sensor/smartmeter_active_power_plus/state' payload='3196.0' retain=1) [20:10:30][V][sensor:074]: 'smartmeter_active_energy_plus': Received new state 9757245.000000 [20:10:30][D][sensor:125]: 'smartmeter_active_energy_plus': Sending state 9757.24512 kWh with 1 decimals of accuracy [20:10:30][V][mqtt:405]: Publish(topic='smartmeter/sensor/smartmeter_active_energy_plus/state' payload='9757.2' retain=1) [20:10:30][V][sensor:074]: 'smartmeter_reactive_energy_plus': Received new state 51420.000000 [20:10:30][D][sensor:125]: 'smartmeter_reactive_energy_plus': Sending state 51.42000 kWh with 1 decimals of accuracy [20:10:30][V][mqtt:405]: Publish(topic='smartmeter/sensor/smartmeter_reactive_energy_plus/state' payload='51.4' retain=1) [20:10:30][V][sensor:074]: 'smartmeter_reactive_energy_minus': Received new state 2558061.000000 [20:10:30][D][sensor:125]: 'smartmeter_reactive_energy_minus': Sending state 2558.06104 kWh with 1 decimals of accuracy [20:10:30][V][mqtt:405]: Publish(topic='smartmeter/sensor/smartmeter_reactive_energy_minus/state' payload='2558.1' retain=1) [20:10:30][I][espdm:329]: Received valid data [20:10:30][V][mqtt:405]: Publish(topic='smartmeter/data' payload='{"voltage_l1":225.9,"voltage_l2":228.9,"voltage_l3":227.6,"current_l1":12.02,"current_l2":2.93,"current_l3":0.27,"active_power_plus":3196,"active_power_minus":0,"active_energy_plus":9757.245,"active_energy_minus":0,"reactive_energy_plus":51.42,"reactive_energy_minus":2558.061,"timestamp":"2022-04-13T20:10:30Z"}' retain=0) [20:10:30][V][component:199]: Component <unknown> took a long time for an operation (0.39 s). [20:10:30][V][component:200]: Components should block for at most 20-30ms. [20:10:45][D][espdm:042]: Handling packet [20:10:45][V][espdm:455]: 68 FA FA 68 53 FF 00 01 67 DB 08 4B 46 4D 10 20 01 D9 16 82 01 55 21 00 01 17 95 FB CB 82 FA D7 10 88 72 72 25 2C 8E E7 39 B2 CE 95 0D 4A E2 A9 32 B7 58 C1 B7 28 1F 57 F1 D8 B9 20 52 D0 46 91 F5 78 E2 3E 92 9A 42 BF B4 23 10 FB E0 8D 5C 89 20 99 8C C2 0A 00 A8 DB F1 27 2C FD 44 DD 52 CB 84 01 D9 36 ED 8E AB 15 09 00 FC 17 99 DF 17 47 48 91 25 80 53 69 8A 43 60 D9 73 CC B4 69 AF 12 54 60 CE B9 35 A1 10 6F 49 B2 30 BE 41 1E 76 60 D6 22 49 55 56 BA 91 72 4C 6E 07 FE 54 FB C4 C4 B3 D7 CA 48 15 20 C6 36 01 2A F4 45 DE 2B DB A9 4E 5F CF FF E8 02 FB 78 B3 C3 BB E6 98 15 96 DD 66 99 FF C6 3F 93 9C 0C 1F B6 DF 18 A4 F2 AB BB 5B 2E 04 D4 52 74 09 FF DF 0B A6 A7 5D 1E 2D 90 BF 90 80 85 17 9B 9D 8C 55 94 D0 AF AF 05 6D 59 09 48 DA 5E DC EE 5B 4B CD 9B 8B 83 8F 6F B9 16 68 72 72 68 53 FF 11 01 67 0F BB 85 0C 10 26 31 3C 05 04 E8 A5 30 A1 98 CC 03 56 C4 7D 48 BD D1 1A 4D E6 EF F1 B4 27 34 0B 59 02 21 72 18 0C B1 A7 AE C6 CB 77 FE 15 28 0E E1 B2 16 09 42 29 DA A7 0E 33 9C 43 C0 1D 6D 5F 0F D9 2F 99 D8 BB DB 78 03 24 2B 67 5F 81 18 0B 61 03 64 C6 75 F8 72 7B E9 CB 21 AD 8A F3 25 D1 15 7F FA 84 38 22 94 CD 4C 93 95 AA 3F B8 16 [20:10:45][V][text_sensor:016]: 'smartmeter_timestamp': Received new state 2022-04-13T20:10:45Z [20:10:45][D][text_sensor:067]: 'smartmeter_timestamp': Sending state '2022-04-13T20:10:45Z' [20:10:45][V][mqtt:405]: Publish(topic='smartmeter/sensor/smartmeter_timestamp/state' payload='2022-04-13T20:10:45Z' retain=1) [20:10:45][V][sensor:074]: 'smartmeter_voltage_l2': Received new state 229.000000 [20:10:45][D][sensor:125]: 'smartmeter_voltage_l2': Sending state 229.00000 V with 1 decimals of accuracy [20:10:45][V][mqtt:405]: Publish(topic='smartmeter/sensor/smartmeter_voltage_l2/state' payload='229.0' retain=1) [20:10:45][V][sensor:074]: 'smartmeter_voltage_l3': Received new state 227.300003 [20:10:45][D][sensor:125]: 'smartmeter_voltage_l3': Sending state 227.30000 V with 1 decimals of accuracy [20:10:45][V][mqtt:405]: Publish(topic='smartmeter/sensor/smartmeter_voltage_l3/state' payload='227.3' retain=1) [20:10:45][V][sensor:074]: 'smartmeter_current_l1': Received new state 11.730000 [20:10:45][D][sensor:125]: 'smartmeter_current_l1': Sending state 11.73000 A with 1 decimals of accuracy [20:10:45][V][mqtt:405]: Publish(topic='smartmeter/sensor/smartmeter_current_l1/state' payload='11.7' retain=1) [20:10:45][V][sensor:074]: 'smartmeter_current_l3': Received new state 0.700000 [20:10:45][D][sensor:125]: 'smartmeter_current_l3': Sending state 0.70000 A with 1 decimals of accuracy [20:10:45][V][mqtt:405]: Publish(topic='smartmeter/sensor/smartmeter_current_l3/state' payload='0.7' retain=1) [20:10:45][V][sensor:074]: 'smartmeter_active_power_plus': Received new state 3261.000000 [20:10:45][D][sensor:125]: 'smartmeter_active_power_plus': Sending state 3261.00000 W with 1 decimals of accuracy [20:10:45][V][mqtt:405]: Publish(topic='smartmeter/sensor/smartmeter_active_power_plus/state' payload='3261.0' retain=1) [20:10:45][V][sensor:074]: 'smartmeter_active_energy_plus': Received new state 1150608000.000000 [20:10:45][D][sensor:125]: 'smartmeter_active_energy_plus': Sending state 1150608.00000 kWh with 1 decimals of accuracy [20:10:45][V][mqtt:405]: Publish(topic='smartmeter/sensor/smartmeter_active_energy_plus/state' payload='1150608.0' retain=1) [20:10:45][V][sensor:074]: 'smartmeter_reactive_energy_plus': Received new state 51420.000000 [20:10:45][D][sensor:125]: 'smartmeter_reactive_energy_plus': Sending state 51.42000 kWh with 1 decimals of accuracy [20:10:45][V][mqtt:405]: Publish(topic='smartmeter/sensor/smartmeter_reactive_energy_plus/state' payload='51.4' retain=1) [20:10:45][V][sensor:074]: 'smartmeter_reactive_energy_minus': Received new state 2558062.000000 [20:10:45][D][sensor:125]: 'smartmeter_reactive_energy_minus': Sending state 2558.06201 kWh with 1 decimals of accuracy [20:10:45][V][mqtt:405]: Publish(topic='smartmeter/sensor/smartmeter_reactive_energy_minus/state' payload='2558.1' retain=1) [20:10:45][I][espdm:329]: Received valid data [20:10:45][V][mqtt:405]: Publish(topic='smartmeter/data' payload='{"voltage_l1":225.9,"voltage_l2":229,"voltage_l3":227.3,"current_l1":11.73,"current_l2":2.93,"current_l3":0.7,"active_power_plus":3261,"active_power_minus":0,"active_energy_plus":1150608,"active_energy_minus":0,"reactive_energy_plus":51.42,"reactive_energy_minus":2558.062,"timestamp":"2022-04-13T20:10:45Z"}' retain=0) [20:10:45][V][component:199]: Component <unknown> took a long time for an operation (0.40 s). [20:10:45][V][component:200]: Components should block for at most 20-30ms. [20:11:00][D][espdm:042]: Handling packet [20:11:00][V][espdm:455]: 68 FA FA 68 53 FF 00 01 67 DB 08 4B 46 4D 10 20 01 D9 16 82 01 55 21 00 01 17 96 2F F7 98 3D BE 65 2A CB 97 86 E4 93 4E 76 1A 3D 97 FF 9D 1F 4B 1B 4E C4 35 79 DF 68 5C C8 1B 36 B2 D9 85 40 B8 32 CE 45 F5 4A 74 1A 09 38 39 09 33 73 7B 93 CE 3F F8 65 22 3B 1E 35 9C 46 E8 6B 58 8C 3B 70 BF C0 82 B5 E1 D7 FD 2F F4 04 7B 0B E0 AB 77 17 BA 5A E4 00 92 07 58 BF 7A 19 BD 24 71 63 43 54 B3 9B 9C 8F 9D 23 7D AC C4 C5 79 38 1A B6 99 61 5A 07 3F 62 4A C3 54 86 D0 AB EA 18 4B 1A 2C FA D8 F4 20 9F DF F2 9E 26 6A 71 EC 82 83 E4 4F 8E F1 F3 72 5F BA A8 5B 72 B5 E7 E7 B5 68 06 02 D8 7D 9D BD 32 22 D1 DD 73 69 DB 77 34 2C 3F 16 DB 72 7B FD 27 B1 25 35 6F 94 DF E8 E2 78 A5 D7 11 EB 48 C4 ED 1C 79 96 A6 3D B2 23 26 99 63 7C 7F 1B D8 5C 4A FE E0 7C 83 73 39 24 8C 70 54 8F F4 16 68 72 72 68 53 FF 11 01 67 4D EC 69 0A 07 26 BD E3 86 6D C2 1A 38 50 76 14 86 DB 75 D1 1D 6F E0 C4 05 01 17 CC 4D 06 34 FC 80 29 DF E6 1C 1E 9F 8D 19 C1 BE 56 CB 33 5D C1 DB AA DA 09 69 40 57 B9 B1 5F E1 7D D1 12 22 B7 D8 4B 94 1F D1 0F F1 DC E7 A6 05 54 3D ED C0 74 50 50 2C 52 8B 74 71 1F 93 8F 70 16 92 B9 3A 76 1A 5E 21 D8 5C 42 87 D6 AE 85 0B 29 D5 50 16 [20:11:00][V][text_sensor:016]: 'smartmeter_timestamp': Received new state 2022-04-13T20:11:00Z [20:11:00][D][text_sensor:067]: 'smartmeter_timestamp': Sending state '2022-04-13T20:11:00Z' [20:11:00][V][mqtt:405]: Publish(topic='smartmeter/sensor/smartmeter_timestamp/state' payload='2022-04-13T20:11:00Z' retain=1) [20:11:00][V][sensor:074]: 'smartmeter_voltage_l1': Received new state 225.699997 [20:11:00][D][sensor:125]: 'smartmeter_voltage_l1': Sending state 225.70000 V with 1 decimals of accuracy [20:11:00][V][mqtt:405]: Publish(topic='smartmeter/sensor/smartmeter_voltage_l1/state' payload='225.7' retain=1) [20:11:00][V][sensor:074]: 'smartmeter_voltage_l2': Received new state 228.800003 [20:11:00][D][sensor:125]: 'smartmeter_voltage_l2': Sending state 228.80000 V with 1 decimals of accuracy [20:11:00][V][mqtt:405]: Publish(topic='smartmeter/sensor/smartmeter_voltage_l2/state' payload='228.8' retain=1) [20:11:00][V][sensor:074]: 'smartmeter_voltage_l3': Received new state 227.100006 [20:11:00][D][sensor:125]: 'smartmeter_voltage_l3': Sending state 227.10001 V with 1 decimals of accuracy [20:11:00][V][mqtt:405]: Publish(topic='smartmeter/sensor/smartmeter_voltage_l3/state' payload='227.1' retain=1) [20:11:00][V][sensor:074]: 'smartmeter_current_l2': Received new state 2.920000 [20:11:00][D][sensor:125]: 'smartmeter_current_l2': Sending state 2.92000 A with 1 decimals of accuracy [20:11:00][V][mqtt:405]: Publish(topic='smartmeter/sensor/smartmeter_current_l2/state' payload='2.9' retain=1) [20:11:00][V][sensor:074]: 'smartmeter_current_l3': Received new state 0.680000 [20:11:00][D][sensor:125]: 'smartmeter_current_l3': Sending state 0.68000 A with 1 decimals of accuracy [20:11:00][V][mqtt:405]: Publish(topic='smartmeter/sensor/smartmeter_current_l3/state' payload='0.7' retain=1) [20:11:00][V][sensor:074]: 'smartmeter_active_power_plus': Received new state 3252.000000 [20:11:00][D][sensor:125]: 'smartmeter_active_power_plus': Sending state 3252.00000 W with 1 decimals of accuracy [20:11:00][V][mqtt:405]: Publish(topic='smartmeter/sensor/smartmeter_active_power_plus/state' payload='3252.0' retain=1) [20:11:00][V][sensor:074]: 'smartmeter_active_energy_plus': Received new state 9757272.000000 [20:11:00][D][sensor:125]: 'smartmeter_active_energy_plus': Sending state 9757.27246 kWh with 1 decimals of accuracy [20:11:00][V][mqtt:405]: Publish(topic='smartmeter/sensor/smartmeter_active_energy_plus/state' payload='9757.3' retain=1) [20:11:00][V][sensor:074]: 'smartmeter_reactive_energy_plus': Received new state 51420.000000 [20:11:00][D][sensor:125]: 'smartmeter_reactive_energy_plus': Sending state 51.42000 kWh with 1 decimals of accuracy [20:11:00][V][mqtt:405]: Publish(topic='smartmeter/sensor/smartmeter_reactive_energy_plus/state' payload='51.4' retain=1) [20:11:00][V][sensor:074]: 'smartmeter_reactive_energy_minus': Received new state 2558063.000000 [20:11:00][D][sensor:125]: 'smartmeter_reactive_energy_minus': Sending state 2558.06299 kWh with 1 decimals of accuracy [20:11:00][V][mqtt:405]: Publish(topic='smartmeter/sensor/smartmeter_reactive_energy_minus/state' payload='2558.1' retain=1)
Normal value at 20:10:30:
[20:10:30][V][sensor:074]: 'smartmeter_active_energy_plus': Received new state 9757245.000000 [20:10:30][D][sensor:125]: 'smartmeter_active_energy_plus': Sending state 9757.24512 kWh with 1 decimals of accuracy
Malformed value at 20:10:45:
[20:10:45][V][sensor:074]: 'smartmeter_active_energy_plus': Received new state 1150608000.000000 [20:10:45][D][sensor:125]: 'smartmeter_active_energy_plus': Sending state 1150608.00000 kWh with 1 decimals of accuracy
Back to normal at 20:11:00:
[20:11:00][V][sensor:074]: 'smartmeter_active_energy_plus': Received new state 9757272.000000 [20:11:00][D][sensor:125]: 'smartmeter_active_energy_plus': Sending state 9757.27246 kWh with 1 decimals of accuracy
My ESPHOME config is as follows:
`esphome:
name: smartmeter
platform: ESP32
board: esp32dev
includes:
- ./esphome-dlms-meter
api:
ota:
password: "abcdexxxx"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
fast_connect: true
manual_ip:
static_ip: xxxx
gateway: xxxx
subnet: xxxx
dns1: xxxx
logger:
level: VERBOSE
#level: DEBUG
#level: INFO
tx_buffer_size: 2048
uart:
tx_pin: GPIO4
rx_pin: GPIO36
baud_rate: 2400
parity: EVEN
data_bits: 8
stop_bits: 1
rx_buffer_size: 2048
id: mbus
mqtt:
broker: xxxx
username: xxxx
password: xxxx
id: mqtt_broker
sensor:
-
platform: template
id: smartmeter_voltage_l1
name: smartmeter_voltage_l1
unit_of_measurement: V
accuracy_decimals: 1
device_class: "voltage"
state_class: "measurement" -
platform: template
id: smartmeter_voltage_l2
name: smartmeter_voltage_l2
unit_of_measurement: V
accuracy_decimals: 1
device_class: "voltage"
state_class: "measurement" -
platform: template
id: smartmeter_voltage_l3
name: smartmeter_voltage_l3
unit_of_measurement: V
accuracy_decimals: 1
device_class: "voltage"
state_class: "measurement" -
platform: template
id: smartmeter_current_l1
name: smartmeter_current_l1
unit_of_measurement: A
accuracy_decimals: 1
device_class: "current"
state_class: "measurement" -
platform: template
id: smartmeter_current_l2
name: smartmeter_current_l2
unit_of_measurement: A
accuracy_decimals: 1
device_class: "current"
state_class: "measurement" -
platform: template
id: smartmeter_current_l3
name: smartmeter_current_l3
unit_of_measurement: A
accuracy_decimals: 1
device_class: "current"
state_class: "measurement" -
platform: template
id: smartmeter_active_power_plus
name: smartmeter_active_power_plus
unit_of_measurement: W
accuracy_decimals: 1
device_class: "power"
state_class: "measurement" -
platform: template
id: smartmeter_active_power_minus
name: smartmeter_active_power_minus
unit_of_measurement: W
accuracy_decimals: 1
device_class: "power"
state_class: "measurement" -
platform: template
id: smartmeter_active_energy_plus
name: smartmeter_active_energy_plus
accuracy_decimals: 1
device_class: "energy"
state_class: "total_increasing"
unit_of_measurement: kWh
filters:- lambda: return x * 0.001;
-
platform: template
id: smartmeter_active_energy_minus
name: smartmeter_active_energy_minus
accuracy_decimals: 1
device_class: "energy"
state_class: "total_increasing"
unit_of_measurement: kWh
filters:- lambda: return x * 0.001;
-
platform: template
id: smartmeter_reactive_energy_plus
name: smartmeter_reactive_energy_plus
accuracy_decimals: 1
device_class: "energy"
state_class: "total_increasing"
unit_of_measurement: kWh
filters:- lambda: return x * 0.001;
-
platform: template
id: smartmeter_reactive_energy_minus
name: smartmeter_reactive_energy_minus
accuracy_decimals: 1
device_class: "energy"
state_class: "total_increasing"
unit_of_measurement: kWh
filters:- lambda: return x * 0.001;
text_sensor:
- platform: template
id: smartmeter_timestamp
name: smartmeter_timestamp
custom_component:
-
lambda: |-
auto dlms_meter = new esphome::espdm::DlmsMeter(id(mbus));
byte key[] = {xxxxx};dlms_meter->set_key(key, 16);
dlms_meter->set_voltage_sensors(id(smartmeter_voltage_l1), id(smartmeter_voltage_l2), id(smartmeter_voltage_l3));
dlms_meter->set_current_sensors(id(smartmeter_current_l1), id(smartmeter_current_l2), id(smartmeter_current_l3));
dlms_meter->set_active_power_sensors(id(smartmeter_active_power_plus), id(smartmeter_active_power_minus));
dlms_meter->set_active_energy_sensors(id(smartmeter_active_energy_plus), id(smartmeter_active_energy_minus));
dlms_meter->set_reactive_energy_sensors(id(smartmeter_reactive_energy_plus), id(smartmeter_reactive_energy_minus));
dlms_meter->enable_mqtt(id(mqtt_broker), "smartmeter/data");
dlms_meter->set_timestamp_sensor(id(smartmeter_timestamp));return {dlms_meter};`
Maybe someone can see the problem.
from esphome-dlms-meter.
In what intervals does this usually happen?
from esphome-dlms-meter.
unregularly - there is no specific time when that happens. i had it once at the 12th of April at 6pm, the once at 11:20pm and again yesterday at 08:10pm. i cannot find any issue with esphome itself or with the lambda calculations. your code must be correct as it gets values from the smartmeter, so i assume there is a problem with either the smartmeter or the MBUS Slave Click.
The system is wired as you suggested. +3v3 is coming from the esp32 chip. the rj11 cable is shielded.
from esphome-dlms-meter.
one more info: my smartmeter is connected via lte insteaf of powerline to vkw and i have enabled the 1/4 hour transmission in vorarlbergnetz portal.
from esphome-dlms-meter.
I also had these issues, but i can´t code and so i added some filters to remove the bad values.
For live watt usage i just cut it off at 5kW as this is the most i use, and for the energy dashboard i use a median
filters:
- median:
window_size: 15
send_every: 5
send_first_at: 4
Works good enough for me, but just a workaround.
But the issues are persistend, i helped a friend with his power meter and he had the same issues.
I am not sure why and didnt really bother looking into it once the filter worked.
Tinetz smartmeter, so prob not an issue with the vorarlberg one
from esphome-dlms-meter.
Thank you Exolor, will try that.
Will report back if that workaround also works for me.
from esphome-dlms-meter.
- platform: template
id: meter01_active_power_plus
name: meter01_active_power_plus
unit_of_measurement: W
accuracy_decimals: 0
device_class: "power"
state_class: "measurement"
filters:
- lambda: |-
float MIN_VALUE = 0.0;
float MAX_VALUE = 5000.0;
if (MIN_VALUE <= x && x <= MAX_VALUE) return x;
else return {};
- platform: template
id: meter01_active_energy_plus
name: meter01_active_energy_plus
unit_of_measurement: Wh
accuracy_decimals: 0
device_class: "energy"
state_class: "total_increasing"
filters:
- median:
window_size: 15
send_every: 5
send_first_at: 4
This would be what my sensors look like, i still get a wrong value with the power sensors sometimes, or i forgot i used the oven at 4 in the morning.
But i dont really care about the live power usage as long as the graph is readable for the rest.
If you still get incorrect data with the energy sensors, you can increase the window_size. As they dont change a lot, it doesnt really matter anyways.
from esphome-dlms-meter.
Thank you @Exolor - it works perfectly fine now. I can live with that workaround.
Thank you for your input.
from esphome-dlms-meter.
One wrong bit in the payload can mess up all values.
I would suggest to check the encrypted APDU. We could verify the APDU by checking a Datatype.
eg. we know the HEX value and the postition of the octet datatype. If it isn't correct we can just drop the APDU.
At least that should work for EVN. I gues it is the same for other providers.
from esphome-dlms-meter.
Since actual spec sheets for the protocol(s) are available now and there is much less guessing going on I rewrote the entire parsing logic so these kind of errors should hopefully be detected by the M-Bus checksum and the length fields.
The changes are in the master branch if anybody wants to give it a try.
from esphome-dlms-meter.
Nope - exchanged all the files, recreated the image and uploaded to the esp. same problem as before.
from esphome-dlms-meter.
@cococheaf The smart meter is probably really providing invalid data then. It's unlikely that errors are not detected by the checksum multiple times.
from esphome-dlms-meter.
from esphome-dlms-meter.
Nope - exchanged all the files, recreated the image and uploaded to the esp. same problem as before.
Same for me, didnt seem to change anything, so as Domi said, prob a problem with the smart meter.
from esphome-dlms-meter.
Nope - exchanged all the files, recreated the image and uploaded to the esp. same problem as before.
Same for me, didnt seem to change anything, so as Domi said, prob a problem with the smart meter.
No it is not. We change hardware to a different esp and problems are gone.
Problem only occurs with esp32 dev board from az delivery
from esphome-dlms-meter.
Nope - exchanged all the files, recreated the image and uploaded to the esp. same problem as before.
Same for me, didnt seem to change anything, so as Domi said, prob a problem with the smart meter.
No it is not. We change hardware to a different esp and problems are gone. Problem only occurs with esp32 dev board from az delivery
Nope - exchanged all the files, recreated the image and uploaded to the esp. same problem as before.
Same for me, didnt seem to change anything, so as Domi said, prob a problem with the smart meter.
No it is not. We change hardware to a different esp and problems are gone. Problem only occurs with esp32 dev board from az delivery
Could very well be, i dont use one from AZ but another chinese board.
Which esp are you using now?
from esphome-dlms-meter.
I think i have found the problem regarding the abnormal data.
The esp32-dev module is now running with no issues, i have changed the RX Pin from GPIO4 to GPIO35.
That fixed the data spikes, i had no spike since one month now.
Maybe someone else with an esp32-dev module can verify that?
- Andre
from esphome-dlms-meter.
Just to confirm a working set-up (at least for the last ~24h :)) using the following configuration:
uart:
tx_pin: GPIO17
rx_pin: GPIO16
baud_rate: 2400
rx_buffer_size: 1024 # Needed to receive the large packets send by the smart meter
id: mbus
This works just fine, thanks for the hint! No more spikes, no more errors or warnings in the webinterface.
Hardware used: AzDelivery ESP32 D1 Mini NodeMCU WiFi Modul + Bluetooth(ESP32-wroom-32) with a MIKROE : M-BUS SLAVE CLICK connected to a KAIFA MA309M (Tinetz).
Flo
I also tried to change tx to GPIO35 - and got the following error message:
uart: [source config/meter01.example.yaml:37]
GPIO35 (34-39) does not support output pin mode.
rx would probably work on GPIO35.
from esphome-dlms-meter.
Also located in Höchst.
Where did you buy the MBus level converter?
from esphome-dlms-meter.
@zibous I'm located in Luschnou ;) .. Have a m-bus slave click from mikroe left over, if you need one :)
from esphome-dlms-meter.
Hi
@zibous I'm located in Luschnou ;) .. Have a m-bus slave click from mikroe left over, if you need one :)
Super, würde den nehmen - wie kann ich den bekommen ?
Projekte/Kontakt siehe https://github.com/zibous
from esphome-dlms-meter.
Hi
@zibous I'm located in Luschnou ;) .. Have a m-bus slave click from mikroe left over, if you need one :)
Super, würde den nehmen - wie kann ich den bekommen ?
Projekte/Kontakt siehe https://github.com/zibous
u got mail ... ruf einfach kurz an ✌🏽
from esphome-dlms-meter.
Sorry - hab erst vorher die Mails durchgeschaut - hat sich aber in dem Fall schon erledigt :)
Viel Spaß beim Basteln ;)
LG
from esphome-dlms-meter.
Related Issues (20)
- [state_class] is an invalid option for [sensor.template] HOT 1
- Payload length is too big for received data HOT 4
- Esphome 12.2022 & HA - MBUS: Start bytes do not match & Frame too big for received data HOT 5
- comments need to be removed from HOT 1
- Support for Kaifa MA110M ? HOT 3
- Error: setRxBufferSize(): RX Buffer can't be resized when Serial is already running.
- hello could you please explain how too install it on esph home on homeassitant HOT 3
- mbedtls/gcm.h: No such file or directory HOT 3
- Kufsteiner Stadtwerke funktioniert auch
- Tinetz Honeywell "/config/esphome/meter01.yaml:164:27: error: invalid conversion from 'const char*' to 'uint8_t*' {aka 'unsigned char*'} [-fpermissive]" HOT 1
- 2 Zähler auslesen
- Decryption key format HOT 2
- Why is a M-BUS slave board needed? (and not a master board) HOT 4
- Very Jumpy Energy Values
- Tinetz Honeywell funktioniert -> Achtung Anzahl der Stellen HOT 1
- Power ESP via M-Bus HOT 5
- Start bytes do not match nach Monaten ohne Probleme
- Possible to Read Water-Meters?
- meter01 is working
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esphome-dlms-meter.