core: Magicseaweed integration - error setting up platform
The problem
Now receiving an error on the Magicseaweed integration which was working in previous versions.
Error in the logs:
Logger: homeassistant.components.sensor
Source: components/magicseaweed/sensor.py:202
Integration: Sensor ([documentation](https://www.home-assistant.io/integrations/sensor), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+sensor%22))
First occurred: 10:54:18 (1 occurrences)
Last logged: 10:54:18
Error while setting up magicseaweed platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 250, in _async_setup_platform
await asyncio.shield(task)
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/magicseaweed/sensor.py", line 101, in setup_platform
forecast_data.update()
File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 192, in wrapper
result = method(*args, **kwargs)
File "/usr/src/homeassistant/homeassistant/components/magicseaweed/sensor.py", line 202, in _update
forecasts = self._msw.get_future()
File "/usr/local/lib/python3.10/site-packages/magicseaweed/__init__.py", line 179, in get_future
return get_msw(url)
File "/usr/local/lib/python3.10/site-packages/magicseaweed/__init__.py", line 153, in get_msw
return ForecastDataBlock(json_d, headers, msw_response)
File "/usr/local/lib/python3.10/site-packages/magicseaweed/__init__.py", line 199, in __init__
self.data = [ForecastDataPoint(datapoint)
File "/usr/local/lib/python3.10/site-packages/magicseaweed/__init__.py", line 199, in <listcomp>
self.data = [ForecastDataPoint(datapoint)
File "/usr/local/lib/python3.10/site-packages/magicseaweed/__init__.py", line 216, in __init__
self.f_d = _flatten(d)
File "/usr/local/lib/python3.10/site-packages/magicseaweed/__init__.py", line 57, in _flatten
if isinstance(v, collections.MutableMapping):
AttributeError: module 'collections' has no attribute 'MutableMapping'
What version of Home Assistant Core has the issue?
core-2022.7.1
What was the last working version of Home Assistant Core?
core-2022.6.1
What type of installation are you running?
Home Assistant Supervised
Integration causing the issue
Magicseaweed
Link to integration documentation on our website
https://www.home-assistant.io/integrations/magicseaweed/
Diagnostics information
No response
Example YAML snippet
sensor:
- platform: magicseaweed
api_key: !secret magicseaweed_key
spot_id: 4439
monitored_conditions:
- swell_forecast
- min_breaking_swell
- max_breaking_swell
### Anything in the logs that might be useful for us?
```txt
Logger: homeassistant.components.sensor
Source: components/magicseaweed/sensor.py:202
Integration: Sensor ([documentation](https://www.home-assistant.io/integrations/sensor), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+sensor%22))
First occurred: 10:54:18 (1 occurrences)
Last logged: 10:54:18
Error while setting up magicseaweed platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 250, in _async_setup_platform
await asyncio.shield(task)
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/magicseaweed/sensor.py", line 101, in setup_platform
forecast_data.update()
File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 192, in wrapper
result = method(*args, **kwargs)
File "/usr/src/homeassistant/homeassistant/components/magicseaweed/sensor.py", line 202, in _update
forecasts = self._msw.get_future()
File "/usr/local/lib/python3.10/site-packages/magicseaweed/__init__.py", line 179, in get_future
return get_msw(url)
File "/usr/local/lib/python3.10/site-packages/magicseaweed/__init__.py", line 153, in get_msw
return ForecastDataBlock(json_d, headers, msw_response)
File "/usr/local/lib/python3.10/site-packages/magicseaweed/__init__.py", line 199, in __init__
self.data = [ForecastDataPoint(datapoint)
File "/usr/local/lib/python3.10/site-packages/magicseaweed/__init__.py", line 199, in <listcomp>
self.data = [ForecastDataPoint(datapoint)
File "/usr/local/lib/python3.10/site-packages/magicseaweed/__init__.py", line 216, in __init__
self.f_d = _flatten(d)
File "/usr/local/lib/python3.10/site-packages/magicseaweed/__init__.py", line 57, in _flatten
if isinstance(v, collections.MutableMapping):
AttributeError: module 'collections' has no attribute 'MutableMapping'
### Additional information
_No response_
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 18 (9 by maintainers)
We have discussed this integration with some Core members, and decided to remove this integration from our Core codebase as it is not functioning and no new API keys can’t be obtained either.
Even if future refactoring would make this integration back into a modern and working state, API keys would still be a problem. Therefore, we don’t see a future for this integration maintained in Core. One is still free to release a refactored version as a custom integration of course.
…/Frenck
I’m working on a MR to use the new config flow and the new version of python-magic seaweed.
For those who are interested, I’ll be developing the custom integration in this repo: https://github.com/jcconnell/magicseaweed-for-home-assistant
I’m taking a look at changes that should resolve this issue in the MSW module. It’s a small change but I want to make sure I understand the implications. I’ll submit a PR to increment the version for Home Assistant once it’s ready.