Baldhor / Homey-ESPhome-Enhanced

This is an Homey app which adds support for ESPHome devices. ESPHome is a system to control your ESP8266/ESP32 by simple yet powerful configuration files and control them remotely through Home Automation systems. More information on their homepage: https://www.esphome.io/
GNU General Public License v3.0
4 stars 3 forks source link

Slimmelezer ESP device keeps crashing periodically #35

Closed RoadXY closed 9 months ago

RoadXY commented 9 months ago

Describe the bug Slimmelezer ESP device keeps crashing periodically

Device type Custom device by Marcel Zuidwijk. Bought here: https://www.zuidwijk.com/product/slimmelezer-plus/

image

YAML file

substitutions:
  device_name: slimmelezer

esphome:
  name: ${device_name}
  platform: ESP8266
  esp8266_restore_from_flash: true
  board: d1_mini
  name_add_mac_suffix: false

wifi:
  ap:
    ssid: ${device_name}

  ssid: !secret wifi_ssid
  password: !secret wifi_password

captive_portal:

# Enable logging
logger:
  baud_rate: 0

# Enable Home Assistant API
api:

ota:

web_server:
  port: 80

uart:
  baud_rate: 115200
  rx_pin: D7
  rx_buffer_size: 1700

dsmr:
  id: dsmr_instance
  max_telegram_length: 1700
  gas_mbus_id: 1
  request_interval: 30s

sensor:
  - platform: dsmr
    energy_delivered_tariff1:
      name: "Energy Consumed Tariff 1"
    energy_delivered_tariff2:
      name: "Energy Consumed Tariff 2"
    energy_returned_tariff1:
      name: "Energy Produced Tariff 1"
    energy_returned_tariff2:
      name: "Energy Produced Tariff 2"
    power_delivered:
      name: "Power Consumed"
      accuracy_decimals: 3
    power_returned:
      name: "Power Produced"
      accuracy_decimals: 3
    electricity_failures:
      name: "Electricity Failures"
      icon: mdi:alert
    electricity_long_failures:
      name: "Long Electricity Failures"
      icon: mdi:alert
    voltage_l1:
      name: "Voltage Phase 1"
    voltage_l2:
      name: "Voltage Phase 2"
    voltage_l3:
      name: "Voltage Phase 3"
    current_l1:
      name: "Current Phase 1"
    current_l2:
      name: "Current Phase 2"
    current_l3:
      name: "Current Phase 3"
    power_delivered_l1:
      name: "Power Consumed Phase 1"
      accuracy_decimals: 3
    power_delivered_l2:
      name: "Power Consumed Phase 2"
      accuracy_decimals: 3
    power_delivered_l3:
      name: "Power Consumed Phase 3"
      accuracy_decimals: 3
    power_returned_l1:
      name: "Power Produced Phase 1"
      accuracy_decimals: 3
    power_returned_l2:
      name: "Power Produced Phase 2"
      accuracy_decimals: 3
    power_returned_l3:
      name: "Power Produced Phase 3"
      accuracy_decimals: 3
    gas_delivered:
      name: "Gas Consumed"

  - platform: wifi_signal
    name: "WiFi Signaal"
    id: wifi_signalstrength
    update_interval: 900s
    icon: 'mdi:signal'

  - platform: uptime
    name: "Uptime"
    id: uptime_sensor
    internal: true
    update_interval: 600s
    icon: 'mdi:clock-outline'
    filters:
      - lambda: return x / 60;
    unit_of_measurement: "min"

text_sensor:
  - platform: dsmr
    identification:
      name: "DSMR Identification"
    p1_version:
      name: "DSMR Version"
  - platform: version
    name: "ESPHome Version"
    hide_timestamp: true
Baldhor commented 9 months ago

@RoadXY Fo rme the problem come from your device, so it's very difficult to help you. The best I could do is add logging of the raw data received when the problem occur, but as far as I can tell you can find it using the web server interface (action 1 below).

Dutch, BE and LUX are using DSMR seems, but with a few difference in the implementation. Based on your configuration I think you are dutch (or at least living there), if not your conf is wrong :)

I would advice to check: 1/ The log of the device itself after it "crashed"

2/ Test if using encryptionKey the problem disappear (I don't beieve it will ...)

3/ Increase buffer and telegram size to 3000 It seems that the data length is a reccurrent issue

Baldhor commented 9 months ago

@RoadXY As far as I can remember, everytime you have an error with your slimmmezer, whithin the same 30 seconds, you also lose connection to another device:

2023-09-06T18:12:43.611Z [log] [ManagerDrivers] [Driver:esphome-wizard] [PhysicalDevice:[192.168.0.25:6053](http://192.168.0.25:6053/)] Disconnected: unavailable!
2023-09-06T18:12:48.599Z [log] [ManagerDrivers] [Driver:esphome-wizard] [PhysicalDevice:[192.168.0.25:6053](http://192.168.0.25:6053/)] Disconnected: unavailable!
2023-09-06T18:12:58.932Z [log] [ManagerDrivers] [Driver:esphome-device] [Device:199f541e-b5b7-4aa1-9511-ff64ede5e3cb]  [0;36m[D][sensor:094]: 'WiFi Signaal': Sending state -87.00000 dBm with 0 decimals of accuracy [0m
2023-09-06T18:13:00.836Z [log] [ManagerDrivers] [Driver:esphome-device] [Device:c701d0d0-7864-49e9-9960-2cba15d9cd4a] Error on device lage-staande-lamp: Error: connect EHOSTUNREACH [192.168.0.22:6053](http://192.168.0.22:6053/)
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1157:16) {
  errno: -113,
  code: 'EHOSTUNREACH',
  syscall: 'connect',
  address: '192.168.0.22',
  port: 6053
}

What's the relationship between both ?

Baldhor commented 9 months ago

@RoadXY And can you confirm, when your connection to the slimmezer is broken, if you jsut restart the ESPhome app, it works again ?

RoadXY commented 9 months ago

@RoadXY As far as I can remember, everytime you have an error with your slimmmezer, whithin the same 30 seconds, you also lose connection to another device:

2023-09-06T18:12:43.611Z [log] [ManagerDrivers] [Driver:esphome-wizard] [PhysicalDevice:[192.168.0.25:6053](http://192.168.0.25:6053/)] Disconnected: unavailable!
2023-09-06T18:12:48.599Z [log] [ManagerDrivers] [Driver:esphome-wizard] [PhysicalDevice:[192.168.0.25:6053](http://192.168.0.25:6053/)] Disconnected: unavailable!
2023-09-06T18:12:58.932Z [log] [ManagerDrivers] [Driver:esphome-device] [Device:199f541e-b5b7-4aa1-9511-ff64ede5e3cb]  [0;36m[D][sensor:094]: 'WiFi Signaal': Sending state -87.00000 dBm with 0 decimals of accuracy [0m
2023-09-06T18:13:00.836Z [log] [ManagerDrivers] [Driver:esphome-device] [Device:c701d0d0-7864-49e9-9960-2cba15d9cd4a] Error on device lage-staande-lamp: Error: connect EHOSTUNREACH [192.168.0.22:6053](http://192.168.0.22:6053/)
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1157:16) {
  errno: -113,
  code: 'EHOSTUNREACH',
  syscall: 'connect',
  address: '192.168.0.22',
  port: 6053
}

What's the relationship between both ?

None. The "lage-staande-lamp" is a device which is unplugged from the wall a lot for various reasons. Maybe that's it? I've never had this device failing after time (only when unplugged, offcourse)

Baldhor commented 9 months ago

@RoadXY Finaly, if your device is correctly connected to homey, and then you restart your device itself (do not touch the app), does it reconnect autoamtically (and correctly) ?

RoadXY commented 9 months ago

@RoadXY And can you confirm, when your connection to the slimmezer is broken, if you jsut restart the ESPhome app, it works again ?

Yes, it always is back online if I restart the ESPhome app on Homey

RoadXY commented 9 months ago

@RoadXY Finaly, if your device is correctly connected to homey, and then you restart your device itself (do not touch the app), does it reconnect autoamtically (and correctly) ?

I will try that, never tried that. P.s. HomeAssistant is always connected to 'slimmelezer' and never fails. This is the only device of the 5 devices I have, which keeps failing.

Baldhor commented 9 months ago

@RoadXY Finaly, if your device is correctly connected to homey, and then you restart your device itself (do not touch the app), does it reconnect autoamtically (and correctly) ?

I will try that, never tried that. P.s. HomeAssistant is always connected to 'slimmelezer' and never fails. This is the only device of the 5 devices I have, which keeps failing.

I think we can consider that the low level client I use has a problem, when losing connection to Slimmezer (DSMR component), it become "unclean", and so further reconnection fail. Recconnection is working smoothly on my own devices. So it seems very particular with DSMR component.

Please test reconnection when restarting the device, from there, I will see how I can work around the issue (for sure I cannot fix the low level client or ESPhome itself :) )

edit: I think the best is to deactivate the auto-reconnect behaviour of the low level client, and handle it on my side. So for sure the low level client is systematicaly renewed from ground up. And we will never have any "unclean" issue anymore.

RoadXY commented 9 months ago

@RoadXY Finaly, if your device is correctly connected to homey, and then you restart your device itself (do not touch the app), does it reconnect autoamtically (and correctly) ?

I will try that, never tried that. P.s. HomeAssistant is always connected to 'slimmelezer' and never fails. This is the only device of the 5 devices I have, which keeps failing.

I think we can consider that the low level client I use has a problem, when losing connection to Slimmezer (DSMR component), it become "unclean", and so further reconnection fail. Recconnection is working smoothly on my own devices. So it seems very particular with DSMR component.

Please test reconnection when restarting the device, from there, I will see how I can work around the issue (for sure I cannot fix the low level client or ESPhome itself :) )

edit: I think the best is to deactivate the auto-reconnect behaviour of the low level client, and handle it on my side. So for sure the low level client is systematically renewed from ground up. And we will never have any "unclean" issue anymore.

My 'lagestaandelamp' always reconnects if I plug it back in the wall! Also when I upgrade the firmware of all of my devices, it all just works and Homey reconnects without any issue. It's only this 'slimmelezer' which is freaking out after a set period of time...

Baldhor commented 9 months ago

@RoadXY Reconnection has been recoded at high level client I tested restarting several times my devices, and it seems to work out as usual for me. I published a test version: https://homey.app/fr-fr/app/nl.inversion.esphome/ESPhome/test/

Please let us know if it works, so I can ask certification!

image

RoadXY commented 9 months ago

I've just installed this test version as well as I'm keeping an eye on the log on the ESPHome device to see if I can catch something.

Baldhor commented 9 months ago

@RoadXY Fixed a null pointer exception, can you update to newest test version? https://homey.app/fr-fr/app/nl.inversion.esphome/ESPhome/test/

This bug apply only when a device is deleted, so it's not directly related to slimmezer issue. Any news about slimmezer ?

RoadXY commented 9 months ago

I've re-added the device, just to make sure. Let's wait and see...

Baldhor commented 9 months ago

I still published the version, seems stable enough and I don't think we will go backward :)

RoadXY commented 9 months ago

Haven't been going offline though! So there is some progress 👌

Baldhor commented 9 months ago

@RoadXY Can you check what happen if you configure different names? Both are named "Voltage fase 3" in your screenshot!

And please open separate issue :)

edit: I was sure I implemented "unique names", but maybe I forgot :)

Baldhor commented 9 months ago

In the devices' settings, all titles of the same capability are the same however I'm 100% positive I had different descriptions for each fase

Just seen this, you mean you made different title, but the app "forgot" and just used the same title everywhere ... ?

Baldhor commented 9 months ago

@RoadXY We consider it as solved?

RoadXY commented 9 months ago

Yes, hasn't crashed anymore 👍