yangqian / hass-cozylife

third party cozylife integration
MIT License
66 stars 14 forks source link

fix TypeError: 'NoneType' object is not iterable #11

Closed zhqu1148980644 closed 11 months ago

zhqu1148980644 commented 11 months ago

config.get could return None

2023-11-29 13:05:20.210 ERROR (MainThread) [homeassistant.components.switch] Error while setting up cozylife platform for switch
Traceback (most recent call last):
  File "/lsiopy/lib/python3.11/site-packages/homeassistant/helpers/entity_platform.py", line 359, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/cozylife/switch.py", line 54, in async_setup_platform
    for item in config.get('switches'):
TypeError: 'NoneType' object is not iterable