BazaJayGee66 / homeassistant_cololight

Custom component to support Cololight in Home-Assistant
MIT License
47 stars 6 forks source link

Unsupported operand type(s) for /: 'NoneType' and 'float' #39

Closed gerdschadler closed 4 months ago

gerdschadler commented 5 months ago

I get the following error, only after restart of Home Assistant - once the cololights are turned on using an effect (or another method then on/off) they work fine also with the toggle.

Log of HA:

Logger: homeassistant.components.websocket_api.http.connection Source: components/websocket_api/commands.py:240 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 07:07:44 (5 occurrences) Last logged: 07:08:11

[140506152245056] unsupported operand type(s) for /: 'NoneType' and 'float' [140506292907072] unsupported operand type(s) for /: 'NoneType' and 'float' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 240, in handle_call_service response = await hass.services.async_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2279, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2316, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 892, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 962, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/light/init.py", line 628, in async_handle_light_on_service await light.async_turn_on(**filter_turn_on_params(light, params)) File "/config/custom_components/cololight/light.py", line 235, in async_turn_on coverted_brightness = max(1, (int(self._brightness / 2.55)))


TypeError: unsupported operand type(s) for /: 'NoneType' and 'float'
BazaJayGee66 commented 4 months ago

Thanks for raising, have found the issue, should have a fix for this soon.

BazaJayGee66 commented 4 months ago

I've added a temporary fix for this as part of v2.0.4.

I looks like the state isn't been retained correctly after a HA restart, which led to the above error.

I've opened #41 to look into a more permanent solution.