AlexxIT / SonoffLAN

Control Sonoff Devices with eWeLink (original) firmware over LAN and/or Cloud from Home Assistant
https://github.com/AlexxIT/Blog
MIT License
2.66k stars 412 forks source link

NSPanel (old) error: TypeError: unsupported operand type(s) for &: 'NoneType' and 'ClimateEntityFeature' #1022

Closed edwardtfn closed 1 year ago

edwardtfn commented 1 year ago

I'm getting this error from my NSPanel since a while. Tried to update both Home Assistant and the panel, but the problem persist.

Any idea?

Logger: homeassistant.components.climate
Source: components/climate/__init__.py:274 
Integration: Climate (documentation, issues) 
First occurred: 21:33:23 (1 occurrences) 
Last logged: 21:33:23

Error adding entities for domain climate with platform sonoff
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 605, in _async_add_entity
    capabilities=entity.capability_attributes,
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 274, in capability_attributes
    if supported_features & ClimateEntityFeature.TARGET_HUMIDITY:
TypeError: unsupported operand type(s) for &: 'NoneType' and 'ClimateEntityFeature'
This error originated from a custom integration.

Logger: custom_components.sonoff.core.ewelink.cloud
Source: components/climate/__init__.py:274 
Integration: Sonoff (documentation, issues) 
First occurred: 21:33:23 (61 occurrences) 
Last logged: 21:48:40

Cloud processing error
Traceback (most recent call last):
  File "/config/custom_components/sonoff/core/ewelink/cloud.py", line 286, in run_forever
    await self._process_ws_msg(resp)
  File "/config/custom_components/sonoff/core/ewelink/cloud.py", line 346, in _process_ws_msg
    self.dispatcher_send(SIGNAL_UPDATE, data)
  File "/config/custom_components/sonoff/core/ewelink/base.py", line 59, in dispatcher_send
    handler(*args, **kwargs)
  File "/config/custom_components/sonoff/core/ewelink/__init__.py", line 188, in cloud_update
    self.dispatcher_send(did, params)
  File "/config/custom_components/sonoff/core/ewelink/base.py", line 59, in dispatcher_send
    handler(*args, **kwargs)
  File "/config/custom_components/sonoff/core/entity.py", line 112, in internal_update
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 567, in _async_write_ha_state
    attr = self.capability_attributes
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 274, in capability_attributes
    if supported_features & ClimateEntityFeature.TARGET_HUMIDITY:
TypeError: unsupported operand type(s) for &: 'NoneType' and 'ClimateEntityFeature'

Home Assistant 2022.10.5 Supervisor 2022.10.0 Operating System 9.3 Frontend 20221010.0 - latest

princzkeljanos commented 1 year ago

I am having very similar issue:

Logger: homeassistant.components.climate
Source: components/climate/__init__.py:274
Integration: Climate ([documentation](https://www.home-assistant.io/integrations/climate), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+climate%22))
First occurred: 3:43:46 PM (4 occurrences)
Last logged: 8:21:33 PM

Error adding entities for domain climate with platform sonoff
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 605, in _async_add_entity
    capabilities=entity.capability_attributes,
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 274, in capability_attributes
    if supported_features & ClimateEntityFeature.TARGET_HUMIDITY:
TypeError: unsupported operand type(s) for &: 'NoneType' and 'ClimateEntityFeature'
mkagawa commented 1 year ago

I have exact same issue.

2022-11-20 09:41:37.890 WARNING (MainThread) [custom_components.sonoff.core.ewelink.cloud] Cloud processing error
Traceback (most recent call last):
  File "/config/custom_components/sonoff/core/ewelink/cloud.py", line 286, in run_forever
    await self._process_ws_msg(resp)
  File "/config/custom_components/sonoff/core/ewelink/cloud.py", line 337, in _process_ws_msg
    self.dispatcher_send(SIGNAL_UPDATE, data)
  File "/config/custom_components/sonoff/core/ewelink/base.py", line 59, in dispatcher_send
    handler(*args, **kwargs)
  File "/config/custom_components/sonoff/core/ewelink/__init__.py", line 188, in cloud_update
    self.dispatcher_send(did, params)
  File "/config/custom_components/sonoff/core/ewelink/base.py", line 59, in dispatcher_send
    handler(*args, **kwargs)
  File "/config/custom_components/sonoff/core/entity.py", line 112, in internal_update
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 579, in _async_write_ha_state
    attr = self.capability_attributes
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 274, in capability_attributes
    if supported_features & ClimateEntityFeature.TARGET_HUMIDITY:
TypeError: unsupported operand type(s) for &: 'NoneType' and 'ClimateEntityFeature'

Home Assistant 2022.11.3 Supervisor 2022.10.2 Operating System 9.3 Frontend 20221108.0 - latest

this is the debug output. it looks like error because NSPanel output does not have correct humidity output?


2022-11-20 09:51:56 [D] 100148b7c8 <= Cloud3 | {'temperature': 17, 'humidity': 'blank', 'tempUnit': 1} | None
2022-11-20 09:51:56 [W] Cloud processing error|  File "/config/custom_components/sonoff/core/ewelink/cloud.py", line 286, in run_forever|    await self._process_ws_msg(resp)|TypeError: unsupported operand type(s) for &: 'NoneType' and 'ClimateEntityFeature'|
``
AlexxIT commented 1 year ago

This problem should be fixed in latests Hass versions. But I have added fix to old Hass versions like 2022.11.3

AlexxIT commented 1 year ago

https://github.com/AlexxIT/SonoffLAN/releases/tag/v3.5.1