-
Notifications
You must be signed in to change notification settings - Fork 712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add HA entities for Schneider Electric Thermostats #3575
base: dev
Are you sure you want to change the base?
Conversation
df07cb1
to
b1412ed
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #3575 +/- ##
==========================================
+ Coverage 89.79% 89.85% +0.06%
==========================================
Files 323 321 -2
Lines 10414 10368 -46
==========================================
- Hits 9351 9316 -35
+ Misses 1063 1052 -11 ☔ View full report in Codecov by Sentry. |
Tested the changes on my devices and everything is working good. A couple of things I couldn't figure out:
Edit: figured out the second issue (had to set |
b1412ed
to
1d9f9ac
Compare
attribute_name=SEUserInterface.AttributeDefs.se_brightness.name, | ||
translation_key="display_brightness", | ||
fallback_name="Display Brightness", | ||
# unit="%", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have PERCENTAGE
as a unit for this. It's just a string: PERCENTAGE = "%"
, so this should already work when uncommented. Can you confirm?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tested, and if I uncomment this line, I get the following error:
Failed to create platform entity: <class 'zha.application.platforms.number.NumberConfigurationEntity'> [args=('b0:c7:de:ff:fe:be:38:1f-1', [<zha.zigbee.cluster_handlers.hvac.UserInterfaceClusterHandler object at 0x7fe3642a55e0>], <zha.zigbee.endpoint.Endpoint object at 0x7fe3642a4c80>, <CustomDeviceV2 model='EKO07259' manuf='Schneider Electric' nwk=0xDC1A ieee=b0:c7:de:ff:fe:be:38:1f is_initialized=True> - quirk_applied: True - quirk_or_device_class: zigpy.quirks.v2.CustomDeviceV2 - quirk_id: None), kwargs={'entity_metadata': NumberMetadata(entity_platform=<EntityPlatform.NUMBER: 'number'>, entity_type=<EntityType.CONFIG: 'config'>, cluster_id=516, endpoint_id=1, cluster_type=<ClusterType.Server: 0>, initially_disabled=False, attribute_initialized_from_cache=True, translation_key='display_inactive_brightness', fallback_name='Display inactive brightness', attribute_name='se_inactive_brightness', reporting_config=None, min=0, max=100, step=1, unit='%', mode=None, multiplier=None, device_class=None)}]
Traceback (most recent call last):
File "/nix/store/2dcvclynic8hvxi9lcfrcsy1k1iwbz1p-python3.12-zha-0.0.39/lib/python3.12/site-packages/zha/application/gateway.py", line 335, in create_platform_entities
platform_entity = platform_entity_class.create_platform_entity(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/2dcvclynic8hvxi9lcfrcsy1k1iwbz1p-python3.12-zha-0.0.39/lib/python3.12/site-packages/zha/application/platforms/number/__init__.py", line 229, in create_platform_entity
return cls(unique_id, cluster_handlers, endpoint, device, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/2dcvclynic8hvxi9lcfrcsy1k1iwbz1p-python3.12-zha-0.0.39/lib/python3.12/site-packages/zha/application/platforms/number/__init__.py", line 242, in __init__
super().__init__(unique_id, cluster_handlers, endpoint, device, **kwargs)
File "/nix/store/2dcvclynic8hvxi9lcfrcsy1k1iwbz1p-python3.12-zha-0.0.39/lib/python3.12/site-packages/zha/application/platforms/__init__.py", line 297, in __init__
self._init_from_quirks_metadata(entity_metadata)
File "/nix/store/2dcvclynic8hvxi9lcfrcsy1k1iwbz1p-python3.12-zha-0.0.39/lib/python3.12/site-packages/zha/application/platforms/number/__init__.py", line 269, in _init_from_quirks_metadata
self._attr_native_unit_of_measurement = validate_unit(
^^^^^^^^^^^^^^
File "/nix/store/2dcvclynic8hvxi9lcfrcsy1k1iwbz1p-python3.12-zha-0.0.39/lib/python3.12/site-packages/zha/units.py", line 167, in validate_unit
return UNITS_OF_MEASURE[type(external_unit).__name__](external_unit.value)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'str'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, as of now, unit
can't be string since then the code resolves into:
UNITS_OF_MEASURE[type("%").__name__](external_unit.value)
-> UNITS_OF_MEASURE['str'](external_unit.value)
-> KeyError: 'str'
4c2b386
to
f811d82
Compare
1b8890a
to
ef32e58
Compare
Proposed change
Add most of the manufacturer specific attributes as Home Assistant entities (numbers, enums).
Additional information
#1705
#3473
Koenkk/zigbee2mqtt#23739
Screenshots
Checklist
pre-commit
checks pass / the code has been formatted using Black