Total daily energy sensor makes 2 out of 4 Gosund SP111 crash

Hi All,

Just since recently 2 of my 4 flashed Gosund SP111 crashes when it uses that Totaly_Daily_Engery sensor. And therefore continuously disconnects and reconnects

I cant find anything in the logs of those 2. I’ve put the log mode on VERY_VERBOSE but that doesn’t deliver me any errors on that part.

!! Extra note : the problem only occurs when the relay is switched on !!

Log part of sensor in ESPHome

> [17:01:04][VV][scheduler:152]: Running interval '' with interval=10000 last_execution=30370 (now=40376)
> [17:01:11][VV][scheduler:152]: Running interval 'update' with interval=10000 last_execution=32240 (now=42242)
> [17:01:11][D][hlw8012:071]: Got power=22.6W, voltage=148.0V
> [17:01:11][V][sensor:013]: 'terrarium_uv_lamp Voltage': Received new state 147.961258
> [17:01:11][D][sensor:099]: 'terrarium_uv_lamp Voltage': Sending state 147.96126 V with 1 decimals of accuracy
> [17:01:11][VV][api.service:105]: send_sensor_state_response: SensorStateResponse {
>   key: 3458683200
>   state: 147.961
>   missing_state: NO
> }
> [17:01:11][V][sensor:013]: 'terrarium_uv_lamp Power': Received new state 22.564972
> [17:01:11][D][sensor:099]: 'terrarium_uv_lamp Power': Sending state 22.56497 W with 1 decimals of accuracy
> [17:01:11][VV][preferences:107]: Saving preferences to flash...
> [17:01:11][VV][preferences:051]: SAVE 2: 0=0x43007755 1=0xDD15DF52 (Type=2207640548, CRC=0xDD15DF52)
> [17:01:11][V][sensor:013]: 'terrarium_uv_lamp Daily Energy': Received new state 128.466141
> [17:01:11][VV][sensor.filter:013]: Filter(0x3fff3bc4)::input(128.466141)
> [17:01:11][VV][sensor.filter:020]: Filter(0x3fff3bc4)::output(0.128466) -> SENSOR
> [17:01:11][D][sensor:099]: 'terrarium_uv_lamp Daily Energy': Sending state 0.12847 kWh with 3 decimals of accuracy
> [17:01:11][VV][api.service:105]: send_sensor_state_response: SensorStateResponse {
>   key: 2207640548
>   state: 0.128466
>   missing_state: NO
> }
> [17:01:11][VV][api.service:105]: send_sensor_state_response: SensorStateResponse {
>   key: 998049265
>   state: 22.565
>   missing_state: NO
> }
> [17:01:11][V][app:081]: A component took a long time in a loop() cycle (4.45 s).
> [17:01:11][V][app:082]: Components should block for at most 20-30ms in loop().
> WARNING Disconnected from API: Timeout while waiting for message response!
> INFO Connecting to terrarium_uv_lamp.local:6053 (192.xxx.xxx.xxx)
> INFO Successfully connected to terrarium_uv_lamp.local

Log part in Home assistant:

2021-06-10 17:02:19 DEBUG (MainThread) [aioesphomeapi.connection] 192.xxx.xxx.xxx: Sending <class 'api_pb2.PingRequest'>: 

2021-06-10 17:02:19 DEBUG (MainThread) [aioesphomeapi.connection] 192.xxx.xxx.xxx: Got message of type <class 'api_pb2.PingResponse'>: 

2021-06-10 17:02:21 INFO (MainThread) [aioesphomeapi.connection] 192.xxx.xxx.xxx: Ping Failed!

2021-06-10 17:02:21 DEBUG (MainThread) [aioesphomeapi.connection] 192.xxx.xxx.xxx: Closed socket

2021-06-10 17:02:21 INFO (MainThread) [aioesphomeapi.connection] 192.xxx.xxx.xxx: Error while reading incoming messages: Error while receiving data: 0 bytes read on a total of 1 expected bytes

2021-06-10 17:02:21 DEBUG (MainThread) [aioesphomeapi.connection] 192.xxx.xxx.xxx: Connecting to 192.xxx.xxx.xxx:6053 (('192.168.0.77', 6053))

2021-06-10 17:02:21 DEBUG (MainThread) [aioesphomeapi.connection] 192.xxx.xxx.xxx: Opened socket for

2021-06-10 17:02:21 DEBUG (MainThread) [aioesphomeapi.connection] 192.xxx.xxx.xxx: Sending <class 'api_pb2.HelloRequest'>: client_info: "Home Assistant 2021.6.3"

2021-06-10 17:02:21 DEBUG (MainThread) [aioesphomeapi.connection] 192.xxx.xxx.xxx: Got message of type <class 'api_pb2.HelloResponse'>: api_version_major: 1

api_version_minor: 4

server_info: "terrarium_uv_lamp (esphome v1.18.0)"

2021-06-10 17:02:21 DEBUG (MainThread) [aioesphomeapi.connection] 192.xxx.xxx.xxx: Successfully connected ('terrarium_uv_lamp (esphome v1.18.0)' API=1.4)

Currently I’ve disabled the total_daily_sensor in those 2 sockets. But I’m really curious what is causing those crashes