plugwise / plugwise_usb-beta

Custom-component / development version of the USB Plugwise Home Assistant platform
MIT License
5 stars 4 forks source link

[BUG]: Async-version: the cache-directory and files are not created. #174

Closed bouwew closed 2 months ago

bouwew commented 2 months ago

Describe the bug.

When I add the Plugwise USB beta integration as a new Integration, it fails with an error about the cache-directory not being present.

What version of Plugwise Beta are you using?

v0.50.0a4

What was the last working version of Plugwise Beta (or Core if not using beta before)?

v0.40.7

What version of Home Assistant Core are you using?

core-2024.8.2

What type of installation are you running?

Home Assistant Supervised

How did you install plugwise-beta?

HACS

What kind of Plugwise device is having issues?

Stick (USB)

What firmware version is your Plugwise product at?

Unknown

Logging

Logger: homeassistant.config_entries
Source: config_entries.py:604
First occurred: 16:43:30 (1 occurrences)
Last logged: 16:43:30

Error setting up entry Stick for plugwise_usb
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/plugwise_usb/__init__.py", line 82, in async_setup_entry
    await api_stick.discover_coordinator(load=False)
  File "/usr/local/lib/python3.12/site-packages/plugwise_usb/__init__.py", line 312, in discover_coordinator
    await self._network.discover_network_coordinator(load=load)
  File "/usr/local/lib/python3.12/site-packages/plugwise_usb/network/__init__.py", line 269, in discover_network_coordinator
    if await self._discover_node(
       ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/plugwise_usb/network/__init__.py", line 429, in _discover_node
    await self._notify_node_event_subscribers(NodeEvent.DISCOVERED, mac)
  File "/usr/local/lib/python3.12/site-packages/plugwise_usb/network/__init__.py", line 575, in _notify_node_event_subscribers
    await gather(*callback_list)
  File "/config/custom_components/plugwise_usb/__init__.py", line 71, in async_node_discovered
    await node.load()
  File "/usr/local/lib/python3.12/site-packages/plugwise_usb/nodes/circle_plus.py", line 37, in load
    if await self._load_from_cache():
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/plugwise_usb/nodes/circle.py", line 745, in _load_from_cache
    if not await super()._load_from_cache():
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/plugwise_usb/nodes/__init__.py", line 404, in _load_from_cache
    if not await self._load_cache_file():
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/plugwise_usb/nodes/__init__.py", line 392, in _load_cache_file
    await self._node_cache.initialize_cache()
  File "/usr/local/lib/python3.12/site-packages/plugwise_usb/helpers/cache.py", line 52, in initialize_cache
    raise CacheError(f"Unable to initialize caching. Cache folder '{self._root_dir}' does not exists.")
plugwise_usb.exceptions.CacheError: Unable to initialize caching. Cache folder '/config/.storage/plugwisecache-01J62DF8NMF7C4W0ZCQAXDA2Z8' does not exists.

Diagnostics information

No response

Additional information

My HA system is running in a Proxmox virtual container.

brefra commented 2 months ago

Should be fixed in v0.50.0a7

bouwew commented 2 months ago

Thanks! I'll test and report back.

bouwew commented 2 months ago

After adding the integration again I see it has found the Stealth M+. But now I see this in HA Logs:

2024-08-25 09:04:30.193 WARNING (MainThread) [plugwise_usb.helpers.cache] OS error [Errno 2] No such file or directory: '/config/.storage/plugwisecache-01J645KGX3XPKCBQR6RT25F2FR/000D6F00028FC9E8.cache' while reading cache file /config/.storage/plugwisecache-01J645KGX3XPKCBQR6RT25F2FR/000D6F00028FC9E8.cache
2024-08-25 09:04:30.287 WARNING (MainThread) [plugwise_usb.helpers.cache] OS error [Errno 2] No such file or directory: '/config/.storage/plugwisecache-01J645KGX3XPKCBQR6RT25F2FR/000D6F00028FC9E8.cache' while reading cache file /config/.storage/plugwisecache-01J645KGX3XPKCBQR6RT25F2FR/000D6F00028FC9E8.cache
2024-08-25 09:04:30.402 WARNING (MainThread) [plugwise_usb.helpers.cache] OS error [Errno 2] No such file or directory: '/config/.storage/plugwisecache-01J645KGX3XPKCBQR6RT25F2FR/nodes.cache' while reading cache file /config/.storage/plugwisecache-01J645KGX3XPKCBQR6RT25F2FR/nodes.cache
2024-08-25 09:04:40.505 WARNING (MainThread) [plugwise_usb.helpers.cache] OS error [Errno 2] No such file or directory: '/config/.storage/plugwisecache-01J645KGX3XPKCBQR6RT25F2FR/000D6F00029C2B30.cache' while reading cache file /config/.storage/plugwisecache-01J645KGX3XPKCBQR6RT25F2FR/000D6F00029C2B30.cache
2024-08-25 09:04:40.610 WARNING (MainThread) [custom_components.plugwise_usb.sensor] No NodeFeature.ENERGY sensor data for 000D6F00028FC9E8
2024-08-25 09:04:43.753 WARNING (MainThread) [plugwise_usb.helpers.cache] OS error [Errno 2] No such file or directory: '/config/.storage/plugwisecache-01J645KGX3XPKCBQR6RT25F2FR/000D6F00029C2B30.cache' while reading cache file /config/.storage/plugwisecache-01J645KGX3XPKCBQR6RT25F2FR/000D6F00029C2B30.cache
2024-08-25 09:04:46.154 WARNING (MainThread) [plugwise_usb.helpers.cache] OS error [Errno 2] No such file or directory: '/config/.storage/plugwisecache-01J645KGX3XPKCBQR6RT25F2FR/000D6F0004A1D580.cache' while reading cache file /config/.storage/plugwisecache-01J645KGX3XPKCBQR6RT25F2FR/000D6F0004A1D580.cache
2024-08-25 09:04:46.278 WARNING (MainThread) [plugwise_usb.helpers.cache] OS error [Errno 2] No such file or directory: '/config/.storage/plugwisecache-01J645KGX3XPKCBQR6RT25F2FR/000D6F0004A1D580.cache' while reading cache file /config/.storage/plugwisecache-01J645KGX3XPKCBQR6RT25F2FR/000D6F0004A1D580.cache
2024-08-25 09:04:46.852 WARNING (MainThread) [plugwise_usb.helpers.cache] OS error [Errno 2] No such file or directory: '/config/.storage/plugwisecache-01J645KGX3XPKCBQR6RT25F2FR/000D6F0003562D3C.cache' while reading cache file /config/.storage/plugwisecache-01J645KGX3XPKCBQR6RT25F2FR/000D6F0003562D3C.cache
2024-08-25 09:04:46.910 WARNING (MainThread) [plugwise_usb.helpers.cache] OS error [Errno 2] No such file or directory: '/config/.storage/plugwisecache-01J645KGX3XPKCBQR6RT25F2FR/000D6F0003562D3C.cache' while reading cache file /config/.storage/plugwisecache-01J645KGX3XPKCBQR6RT25F2FR/000D6F0003562D3C.cache
2024-08-25 09:04:47.482 WARNING (MainThread) [plugwise_usb.helpers.cache] OS error [Errno 2] No such file or directory: '/config/.storage/plugwisecache-01J645KGX3XPKCBQR6RT25F2FR/000D6F0003562C9E.cache' while reading cache file /config/.storage/plugwisecache-01J645KGX3XPKCBQR6RT25F2FR/000D6F0003562C9E.cache
2024-08-25 09:04:47.593 WARNING (MainThread) [plugwise_usb.helpers.cache] OS error [Errno 2] No such file or directory: '/config/.storage/plugwisecache-01J645KGX3XPKCBQR6RT25F2FR/000D6F0003562C9E.cache' while reading cache file /config/.storage/plugwisecache-01J645KGX3XPKCBQR6RT25F2FR/000D6F0003562C9E.cache
2024-08-25 09:04:48.205 WARNING (MainThread) [plugwise_usb.helpers.cache] OS error [Errno 2] No such file or directory: '/config/.storage/plugwisecache-01J645KGX3XPKCBQR6RT25F2FR/000D6F0003562CC1.cache' while reading cache file /config/.storage/plugwisecache-01J645KGX3XPKCBQR6RT25F2FR/000D6F0003562CC1.cache
2024-08-25 09:04:48.307 WARNING (MainThread) [plugwise_usb.helpers.cache] OS error [Errno 2] No such file or directory: '/config/.storage/plugwisecache-01J645KGX3XPKCBQR6RT25F2FR/000D6F0003562CC1.cache' while reading cache file /config/.storage/plugwisecache-01J645KGX3XPKCBQR6RT25F2FR/000D6F0003562CC1.cache
2024-08-25 09:04:48.678 WARNING (MainThread) [plugwise_usb.helpers.cache] OS error [Errno 2] No such file or directory: '/config/.storage/plugwisecache-01J645KGX3XPKCBQR6RT25F2FR/000D6F0003562003.cache' while reading cache file /config/.storage/plugwisecache-01J645KGX3XPKCBQR6RT25F2FR/000D6F0003562003.cache
2024-08-25 09:04:48.851 WARNING (MainThread) [plugwise_usb.helpers.cache] OS error [Errno 2] No such file or directory: '/config/.storage/plugwisecache-01J645KGX3XPKCBQR6RT25F2FR/000D6F0003562003.cache' while reading cache file /config/.storage/plugwisecache-01J645KGX3XPKCBQR6RT25F2FR/000D6F0003562003.cache
2024-08-25 09:04:51.010 WARNING (MainThread) [plugwise_usb.helpers.cache] OS error [Errno 2] No such file or directory: '/config/.storage/plugwisecache-01J645KGX3XPKCBQR6RT25F2FR/000D6F0002C0DE81.cache' while reading cache file /config/.storage/plugwisecache-01J645KGX3XPKCBQR6RT25F2FR/000D6F0002C0DE81.cache
2024-08-25 09:04:51.103 WARNING (MainThread) [plugwise_usb.helpers.cache] OS error [Errno 2] No such file or directory: '/config/.storage/plugwisecache-01J645KGX3XPKCBQR6RT25F2FR/000D6F0002C0DE81.cache' while reading cache file /config/.storage/plugwisecache-01J645KGX3XPKCBQR6RT25F2FR/000D6F0002C0DE81.cache
2024-08-25 09:04:54.395 WARNING (MainThread) [custom_components.plugwise_usb.sensor] No NodeFeature.ENERGY sensor data for 000D6F00029C2B30
2024-08-25 09:04:55.734 WARNING (MainThread) [custom_components.plugwise_usb.sensor] No NodeFeature.ENERGY sensor data for 000D6F00028FC9E8
2024-08-25 09:04:57.198 WARNING (MainThread) [custom_components.plugwise_usb.sensor] No NodeFeature.ENERGY sensor data for 000D6F0003562D3C
2024-08-25 09:04:57.230 WARNING (MainThread) [custom_components.plugwise_usb.sensor] No NodeFeature.ENERGY sensor data for 000D6F0004A1D580
2024-08-25 09:04:58.877 WARNING (MainThread) [custom_components.plugwise_usb.sensor] No NodeFeature.ENERGY sensor data for 000D6F0003562CC1
2024-08-25 09:04:59.398 WARNING (MainThread) [custom_components.plugwise_usb.sensor] No NodeFeature.ENERGY sensor data for 000D6F0003562003
2024-08-25 09:05:01.522 WARNING (MainThread) [custom_components.plugwise_usb.sensor] No NodeFeature.ENERGY sensor data for 000D6F0002C0DE81
2024-08-25 09:05:10.844 WARNING (MainThread) [custom_components.plugwise_usb.sensor] No NodeFeature.ENERGY sensor data for 000D6F00028FC9E8
2024-08-25 09:05:11.547 WARNING (MainThread) [custom_components.plugwise_usb.sensor] No NodeFeature.ENERGY sensor data for 000D6F0003562D3C
2024-08-25 09:05:11.632 WARNING (MainThread) [custom_components.plugwise_usb.sensor] No NodeFeature.ENERGY sensor data for 000D6F0004A1D580
2024-08-25 09:05:13.340 WARNING (MainThread) [custom_components.plugwise_usb.sensor] No NodeFeature.ENERGY sensor data for 000D6F0003562C9E
2024-08-25 09:05:14.726 WARNING (MainThread) [custom_components.plugwise_usb.sensor] No NodeFeature.ENERGY sensor data for 000D6F0003562003
2024-08-25 09:05:25.735 WARNING (MainThread) [custom_components.plugwise_usb.sensor] No NodeFeature.ENERGY sensor data for 000D6F00028FC9E8
2024-08-25 09:05:26.527 WARNING (MainThread) [custom_components.plugwise_usb.sensor] No NodeFeature.ENERGY sensor data for 000D6F0003562D3C
2024-08-25 09:05:26.579 WARNING (MainThread) [custom_components.plugwise_usb.sensor] No NodeFeature.ENERGY sensor data for 000D6F0004A1D580
2024-08-25 09:05:29.606 WARNING (MainThread) [custom_components.plugwise_usb.sensor] No NodeFeature.ENERGY sensor data for 000D6F0003562003
2024-08-25 09:05:40.736 WARNING (MainThread) [custom_components.plugwise_usb.sensor] No NodeFeature.ENERGY sensor data for 000D6F00028FC9E8
2024-08-25 09:05:41.471 WARNING (MainThread) [custom_components.plugwise_usb.sensor] No NodeFeature.ENERGY sensor data for 000D6F0004A1D580
2024-08-25 09:05:42.751 WARNING (MainThread) [plugwise_usb.connection.queue] No device response to CircleEnergyLogsRequest (mac=000D6F0004A1D580, seq_id=UNKNOWN, attempt=3, log_address=3798) within 15 seconds, cancel request
2024-08-25 09:05:48.704 WARNING (MainThread) [custom_components.plugwise_usb.sensor] No NodeFeature.ENERGY sensor data for 000D6F00029C2B30
2024-08-25 09:05:54.481 WARNING (MainThread) [plugwise_usb.connection.receiver] No subscriber to handle CirclePowerUsageResponse, seq_id=b'9C17' from 000D6F00029C2B30 after 10 retries
2024-08-25 09:05:56.475 WARNING (MainThread) [custom_components.plugwise_usb.sensor] No NodeFeature.ENERGY sensor data for 000D6F0004A1D580
bouwew commented 2 months ago

I'm now seeing all 7 Circles too.

And I'm seeing this in .storage: image

bouwew commented 2 months ago

Tested to be solved in v0.50.0a9, thanks! @brefra :)