core icon indicating copy to clipboard operation
core copied to clipboard

Single TP-Link/Kasa device sometimes going unavailable at exactly midnight

Open glenviewjeff opened this issue 5 months ago • 4 comments

The problem

I have several times noticed that one of my TP-Link/Kasa devices (static IP assigned) sometimes becomes unavailable starting exactly at midnight. The unavailable state persists for many hours and I can't seem to resolve the problem manually. The device (along with most other of my Kasa devices) is isolated from the internet using my Google WiFi router. Enabling internet access from the router does allow the Kasa app to see the device and control it, but it does not make the device become available in HA. Normally HA works just fine with the device disabled.

Weirdly, the debug log is showing that HA is communicating and getting responses from the device in question (search for IP ending in 87.37).

What version of Home Assistant Core has the issue?

core-2024.9.0

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

TP-Link Smart Home

Link to integration documentation on our website

https://www.home-assistant.io/integrations/tplink/

Diagnostics information

home-assistant_tplink_2024-09-06T19-24-21.721Z.log

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Note this failure, but earlier success. Failure log:
2024-09-06 14:23:05.473 DEBUG (MainThread) [homeassistant.components.tplink.coordinator] Finished fetching 192.168.87.21 data in 0.022 seconds (success: True)
2024-09-06 14:23:06.628 DEBUG (MainThread) [kasa.iotprotocol] Giving up on 192.168.87.37 after 3 retries
2024-09-06 14:23:08.093 DEBUG (MainThread) [kasa.iot.iotdevice] Adding query for <Module Schedule (schedule) for 192.168.86.26>: {'schedule': {'get_rules': None, 'get_next_action': None}}

Success log:
2024-09-06 14:19:25.800 DEBUG (MainThread) [kasa.iotprotocol] 192.168.87.37 >> {"system":{"get_sysinfo":null}}
2024-09-06 14:19:25.814 DEBUG (MainThread) [kasa.xortransport] Device 192.168.87.37 sending query {"system":{"get_sysinfo":null}}
2024-09-06 14:19:25.825 DEBUG (MainThread) [kasa.xortransport] Device 192.168.87.37 query response received
2024-09-06 14:19:25.826 DEBUG (MainThread) [kasa.iotprotocol] 192.168.87.37 << {'system': {'get_sysinfo': {'active_mode': 'none',
                            'alias': '#MASKED_NAME#',
                            'dev_name': 'Smart Wi-Fi Plug Mini',
                            'deviceId': 'REDACTED_B1933F69A1BE541643B584921996F74',
                            'err_code': 0,
                            'feature': 'TIM:ENE',
                            'hwId': '3E2B9A976B98DCFC5C83D11C8CEF7510',
                            'hw_ver': '1.0',
                            'icon_hash': '',
                            'latitude_i': 0,
                            'led_off': 0,
                            'longitude_i': 0,
                            'mac': '50:91:E3:00:00:00',
                            'mic_type': 'IOT.SMARTPLUGSWITCH',
                            'model': 'KP115(US)',
                            'next_action': {'type': -1},
                            'ntc_state': 0,
                            'obd_src': 'tplink',
                            'oemId': 'REDACTED_7EDF4495F681216FEFB0CFB',
                            'on_time': 60167,
                            'relay_state': 1,
                            'rssi': -43,
                            'status': 'new',
                            'sw_ver': '1.0.21 Build 231129 Rel.171238',
                            'updating': 0}}}
2024-09-06 14:19:25.826 DEBUG (MainThread) [kasa.device_factory] Device 192.168.87.37 with connection params True took 0.03 seconds to get_sysinfo
2024-09-06 14:19:25.826 DEBUG (MainThread) [kasa.device] Initializing 192.168.87.37 of type <class 'kasa.iot.iotplug.IotPlug'>
2024-09-06 14:19:25.826 DEBUG (MainThread) [kasa.iot.iotdevice] The device has emeter, querying its information along sysinfo
2024-09-06 14:19:25.826 DEBUG (MainThread) [kasa.iot.iotdevice] Adding module <Module Emeter (emeter) for 192.168.87.37>
2024-09-06 14:19:25.826 DEBUG (MainThread) [kasa.iot.iotdevice] Adding module <Module Schedule (schedule) for 192.168.87.37>
2024-09-06 14:19:25.826 DEBUG (MainThread) [kasa.iot.iotdevice] Adding module <Module Usage (schedule) for 192.168.87.37>
2024-09-06 14:19:25.826 DEBUG (MainThread) [kasa.iot.iotdevice] Adding module <Module Antitheft (anti_theft) for 192.168.87.37>
2024-09-06 14:19:25.827 DEBUG (MainThread) [kasa.iot.iotdevice] Adding module <Module Time (time) for 192.168.87.37>
2024-09-06 14:19:25.827 DEBUG (MainThread) [kasa.iot.iotdevice] Adding module <Module Cloud (cnCloud) for 192.168.87.37>
2024-09-06 14:19:25.827 DEBUG (MainThread) [kasa.iot.iotdevice] Adding module <Module Led (system) for 192.168.87.37>
2024-09-06 14:19:25.827 DEBUG (MainThread) [kasa.iot.iotmodule] Initial update, so consider supported: emeter
2024-09-06 14:19:25.827 DEBUG (MainThread) [kasa.iot.iotdevice] Adding query for <Module Emeter (emeter) for 192.168.87.37>: {'emeter': {'get_realtime': None, 'get_daystat': {'year': 2024, 'month': 9}, 'get_monthstat': {'year': 2024}}}
2024-09-06 14:19:25.827 DEBUG (MainThread) [kasa.iot.iotmodule] Initial update, so consider supported: schedule
2024-09-06 14:19:25.827 DEBUG (MainThread) [kasa.iot.iotdevice] Adding query for <Module Schedule (schedule) for 192.168.87.37>: {'schedule': {'get_rules': None, 'get_next_action': None}}
2024-09-06 14:19:25.827 DEBUG (MainThread) [kasa.iot.iotmodule] Initial update, so consider supported: schedule
2024-09-06 14:19:25.827 DEBUG (MainThread) [kasa.iot.iotdevice] Adding query for <Module Usage (schedule) for 192.168.87.37>: {'schedule': {'get_realtime': None, 'get_daystat': {'year': 2024, 'month': 9}, 'get_monthstat': {'year': 2024}}}
2024-09-06 14:19:25.827 DEBUG (MainThread) [kasa.iot.iotmodule] Initial update, so consider supported: anti_theft
2024-09-06 14:19:25.827 DEBUG (MainThread) [kasa.iot.iotdevice] Adding query for <Module Antitheft (anti_theft) for 192.168.87.37>: {'anti_theft': {'get_rules': None, 'get_next_action': None}}
2024-09-06 14:19:25.827 DEBUG (MainThread) [kasa.iot.iotmodule] Initial update, so consider supported: time
2024-09-06 14:19:25.827 DEBUG (MainThread) [kasa.iot.iotdevice] Adding query for <Module Time (time) for 192.168.87.37>: {'time': {'get_time': None, 'get_timezone': None}}
2024-09-06 14:19:25.827 DEBUG (MainThread) [kasa.iot.iotmodule] Initial update, so consider supported: cnCloud
2024-09-06 14:19:25.828 DEBUG (MainThread) [kasa.iot.iotdevice] Adding query for <Module Cloud (cnCloud) for 192.168.87.37>: {'cnCloud': {'get_info': None}}
2024-09-06 14:19:25.828 DEBUG (MainThread) [kasa.iot.iotdevice] Adding query for <Module Led (system) for 192.168.87.37>: {}
2024-09-06 14:19:25.828 DEBUG (MainThread) [kasa.iotprotocol] 192.168.87.37 >> {"system":{"get_sysinfo":null},"emeter":{"get_realtime":null,"get_daystat":{"year":2024,"month":9},"get_monthstat":{"year":2024}},"schedule":{"get_rules":null,"get_next_action":null,"get_realtime":null,"get_daystat":{"year":2024,"month":9},"get_monthstat":{"year":2024}},"anti_theft":{"get_rules":null,"get_next_action":null},"time":{"get_time":null,"get_timezone":null},"cnCloud":{"get_info":null}}
2024-09-06 14:19:25.828 DEBUG (MainThread) [kasa.xortransport] Device 192.168.87.37 sending query {"system":{"get_sysinfo":null},"emeter":{"get_realtime":null,"get_daystat":{"year":2024,"month":9},"get_monthstat":{"year":2024}},"schedule":{"get_rules":null,"get_next_action":null,"get_realtime":null,"get_daystat":{"year":2024,"month":9},"get_monthstat":{"year":2024}},"anti_theft":{"get_rules":null,"get_next_action":null},"time":{"get_time":null,"get_timezone":null},"cnCloud":{"get_info":null}}
2024-09-06 14:19:27.068 DEBUG (MainThread) [kasa.iot.iotdevice] Adding query for <Module Emeter (emeter) for 192.168.87.31>: {'emeter': {'get_realtime': None, 'get_daystat': {'year': 2024, 'month': 9}, 'get_monthstat': {'year': 2024}}}
2024-09-06 14:19:27.069 DEBUG (MainThread) [kasa.iot.iotdevice] Adding query for <Module Schedule (schedule) for 192.168.87.31>: {'schedule': {'get_rules': None, 'get_next_action': None}}
2024-09-06 14:19:27.069 DEBUG (MainThread) [kasa.iot.iotdevice] Adding query for <Module Usage (schedule) for 192.168.87.31>: {'schedule': {'get_realtime': None, 'get_daystat': {'year': 2024, 'month': 9}, 'get_monthstat': {'year': 2024}}}
2024-09-06 14:19:27.070 DEBUG (MainThread) [kasa.iot.iotdevice] Adding query for <Module Antitheft (anti_theft) for 192.168.87.31>: {'anti_theft': {'get_rules': None, 'get_next_action': None}}
2024-09-06 14:19:27.070 DEBUG (MainThread) [kasa.iot.iotdevice] Adding query for <Module Time (time) for 192.168.87.31>: {'time': {'get_time': None, 'get_timezone': None}}
2024-09-06 14:19:27.070 DEBUG (MainThread) [kasa.iot.iotdevice] Adding query for <Module Cloud (cnCloud) for 192.168.87.31>: {'cnCloud': {'get_info': None}}

Additional information

No response

glenviewjeff avatar Sep 06 '24 19:09 glenviewjeff