-
Notifications
You must be signed in to change notification settings - Fork 664
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
Improve Legrand 064882 cable outlet heat mode #3031
base: dev
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #3031 +/- ##
==========================================
+ Coverage 87.86% 87.94% +0.08%
==========================================
Files 301 301
Lines 9219 9249 +30
==========================================
+ Hits 8100 8134 +34
+ Misses 1119 1115 -4 ☔ View full report in Codecov by Sentry. |
dd6f739
to
2de7ca9
Compare
After the cluster changes are cleaned up we should look at converting this to a v2 quirk instead which would remove the need to open a PR in HA. |
|
a3f72de
to
37ef827
Compare
@dmulcahey How does it work with |
Translations will default to the attribute name. Strings.json will still need a HA PR |
I updated to quirk v2.
I also have an issue with tests |
tests will pass after the Zigpy bump I think. |
4058bd2
to
78d691c
Compare
Yeah, some classes like
Yeah, the enum states aren't translatable at the moment. There's this PR: home-assistant/core#109309, but I see some issues with state restoration when coming from an old version (due to
A helper for creating a quirk v2 device is added with #3032 |
78d691c
to
f2176fb
Compare
Yes I was considering this too. I'm not sure my python level is enough for that but I can give a try 🙂 As I know, there is no standard attribute for the preset in the thermostat cluster right? The idea is to map the 6 heat mode into 2 hvac modes and 5 presets :
I already did something similar in my home assistant qubino custom component : https://github.com/piitaya/home-assistant-qubino-wire-pilot |
Correct, at least not one that's mapped to HA presets for the "generic thermostat implementation" in ZHA. (Also, other devices like the Aqara E1 thermostat currently just implements the preset mode (manual, auto, away) as a config select entity. Of course, it would be better if it were added to the climate entity though.) |
Just my 2 cents : Legrand 064882 cable outlet provides a "hard off" state, by toggling the switch in standard mode, that completely turns off the power (ie no power on the L wire) It's a big advantage compared to the other devices I tried because, for example:
What I'm trying to say is that you maybe should keep the 2 different off modes, mapping it for example like that;
|
a2a4f9c
to
6f2f1e4
Compare
I removed the thermostat cluster, the zha climate integration uses the manufacturer cluster. |
zhaquirks/legrand/wire_pilot.py
Outdated
attr_def = self.find_attribute(attr) | ||
attr_id = attr_def.id | ||
if attr_id == WIRE_PILOT_MODE_ATTR: | ||
attrs[0x0000] = [0x02, 0x00] if value else [0x01, 0x00] |
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.
0x0000 -> LegrandCluster.AttributeDefs.device_mode.id
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.
What do the byte arrays represent? We should name them at a minimum.
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 don't really known why it uses array instead of boolean. My assumption is that legrand is using same attribute for various devices.
type=t.data16, | ||
is_manufacturer_specific=True, | ||
) | ||
led_dark = ZCLAttributeDef( |
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.
What does this do and should it have some sort of config entity in the quirk?
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.
It was here before so I didn't touched it. I will look in details and I may provide a config switch for those attributes if it makes sense in another PR.
type=t.Bool, | ||
is_manufacturer_specific=True, | ||
) | ||
led_on = ZCLAttributeDef( |
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.
should we add a switch config entity for this to the quirk below?
Hi, will this PR be merged some day, or is there a way to test its current progress ? |
I need to write tests in ha core but I don't have much time at the moment. I keep you updated 😊 |
Great ! Thanks 😉 |
Proposed change
Following #2807
Pilot wire mode has been renamed to heat mode.
Enum for device_mode has been removed as it's not used.
The value is now exposed and you can read and write the cluster of the attribute. This will allow the creation of a climate entity in ZHA to control the heat mode.
Additional information
A PR has be open in Home Assistant Core to add the support using climate entity : home-assistant/core#113059
To use the climate entity, user will needed to pass the device in wire pilot mode by toggling the new switch entity : wire pilot mode
Checklist
pre-commit
checks pass / the code has been formatted using Black