Olen / homeassistant-plant

Alternative Plant component of home assistant
308 stars 23 forks source link

Use imported websocket function `async_register_command` instead of accessing it directly #150

Closed hmmbob closed 6 months ago

hmmbob commented 6 months ago

Fix for

2024-03-01 08:51:31.990 WARNING (MainThread) [homeassistant.helpers.frame] Detected that custom integration 'plant' accesses hass.components.websocket_api. This is deprecated and will stop working in Home Assistant 2024.9, it should be updated to import functions used from websocket_api directly at custom_components/plant/init.py, line 224: hass.components.websocket_api.async_register_command(ws_get_info)

Tested locally on HA 2024.4: works fine

Fixes #145

Olen commented 6 months ago

Interessting that this was added back in 2022...

https://github.com/Olen/homeassistant-plant/blame/4061fe446e93e5ee81273f0f3b28514c41087839/custom_components/plant/__init__.py#L9

hmmbob commented 6 months ago

The import was added, but not used (the changed code accessed the function directly instead)

edit: and for some reason they chose now to warn on it

Olen commented 6 months ago

The import was added, but not used (the changed code accessed the function directly instead)

Yeah. I saw that. Wonder why I did that....

LGTM