ZacheryThomas / homeassistant-smartrent

Home Assistant Custom Component for SmartRent Locks 🔐, Thermostats 🌡, Sensors 💧 and Switches💡
MIT License
84 stars 3 forks source link

Sensor NoneType object has no attribute keys #6

Closed jerryc05 closed 2 years ago

jerryc05 commented 2 years ago

I encountered this error when setting up smartrent.

2022-06-27 22:43:39 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up smartrent platform for sensor
Traceback (most recent call last):
  File "***/lib/python3.10/site-packages/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
    await asyncio.shield(task)
  File "***/.homeassistant/custom_components/smartrent/sensor.py", line 55, in async_setup_entry
    for device_class in device.keys():
AttributeError: 'NoneType' object has no attribute 'keys'

It did not however block the setup process of smartrent. It is just a error in console.

jerryc05 commented 2 years ago

debugging shows that the type(dev) that causes error is a <class 'smartrent.switch.BinarySwitch'>, which is not included in sensors_dict

ZacheryThomas commented 2 years ago

Hi! Thanks for reachin out! Takin a look now

ZacheryThomas commented 2 years ago

This should be fixed in the latest release. Let me know if it ends up workin for ya!

jerryc05 commented 2 years ago

Seems like no more errors. Thanks!