-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[wiz] Initial contribution #17681
[wiz] Initial contribution #17681
Conversation
@frejos: thoughts on renaming this to wizconnected as part of this, instead of wizlighting, since it supports smart plugs and fans, not just lights? |
+1 for the renaming. |
Or perhaps simply wiz? Disclaimer: just did a quick search, see for example https://faq.wizconnected.com/hc/en/3-wiz-legacy/faq/35-what-is-wiz-and-how-does-it-work/. And in HA also seems to be just WiZ. |
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.
Many thanks for your contribution! I just had a very quick look and already made a few minor comments. The code already looks nice and clean. 👍 I don't know when/if I would personally have time to review the full binding, so decided to push these comments now.
bundles/org.openhab.binding.wiz/src/main/resources/OH-INF/thing/thing-types.xml
Show resolved
Hide resolved
...inding.wiz/src/main/java/org/openhab/binding/wiz/internal/discovery/WizDiscoveryService.java
Show resolved
Hide resolved
....openhab.binding.wiz/src/main/java/org/openhab/binding/wiz/internal/WizBindingConstants.java
Outdated
Show resolved
Hide resolved
....openhab.binding.wiz/src/main/java/org/openhab/binding/wiz/internal/WizBindingConstants.java
Outdated
Show resolved
Hide resolved
...g.openhab.binding.wiz/src/main/java/org/openhab/binding/wiz/internal/handler/WizHandler.java
Outdated
Show resolved
Hide resolved
...inding.wiz/src/main/java/org/openhab/binding/wiz/internal/config/WizDeviceConfiguration.java
Outdated
Show resolved
Hide resolved
@sfussenegger: what kind of fan do you have? I was browsing through the pywizlighting repo, and noticed their not-yet-merged-but-seemingly-abandoned PR seems to imply that a fan also has a light. If that's the case, we should put the fan-related channels into a separate |
@ccutrer the model I have doesn't have a light, though the controller seems to be supporting it (including an unused connector). So the answer regarding my model is yes and no I guess. The WiZ app discovered it as a fan with light too, but it was possible to change the auto-discovered type to fan-only, suggesting both types are supported by WiZ and should probably be supported by the addon. Great to see this is going into the core modules. Just let me know if you need any help with the fan stuff, I'm ready to help. My previous PR may contain some valuable information too. |
@sfussenegger: I've updated the fan support significantly, but don't have a fan to test with. I'd appreciate if you could pull this down and try it out. Note that you'll have to re-create your things, and re-link your items. If you use discovery, it should detect it as a |
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'm caught up with a few other things, so decided to push some pending comments. I hope you are okay with these small iterations. I now have only 8 files left to check a bit deeper.
....openhab.binding.wiz/src/main/java/org/openhab/binding/wiz/internal/WizBindingConstants.java
Outdated
Show resolved
Hide resolved
...inding.wiz/src/main/java/org/openhab/binding/wiz/internal/config/WizDeviceConfiguration.java
Outdated
Show resolved
Hide resolved
...inding.wiz/src/main/java/org/openhab/binding/wiz/internal/discovery/WizDiscoveryService.java
Outdated
Show resolved
Hide resolved
...nhab.binding.wiz/src/main/java/org/openhab/binding/wiz/internal/handler/WizMediatorImpl.java
Outdated
Show resolved
Hide resolved
...g.wiz/src/main/java/org/openhab/binding/wiz/internal/runnable/WizUpdateReceiverRunnable.java
Outdated
Show resolved
Hide resolved
@ccutrer I've tested today, and found that |
Oh, interesting. I specifically changed to a boolean because I saw that |
@sfussenegger: I reverted the serialization to ints. |
@ccutrer I can verify this works now. A few things I've noticed: ChannelsThe new binding offers the following channels when installed via inbox as
Missing:
When installling as I you want to follow the behavior of the Wiz app you probably want to suggest creating a
|
One more thing: I'm using the demo app in |
I'm not familiar with the demo app. I just use the OSGi console (using It should be noted that anytime I change the structure of the thing within this PR (adding, modifying, or removing channels), you'll have to delete and re-create it. Once the binding has been released as part of an official openHAB release, any further changes will require me to do "update instructions" that will automatically make changes to existing things to bring them up to date with the new structure. So don't expect the signal-strength channel to instantly show up on your fan-only thing! |
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.
Fan works well, only a small error in WizHandler
left.
Possible enhancement: Would there be a way to tell items created for fanSpeed
channel to use stepper widgets by default?
...g.openhab.binding.wiz/src/main/java/org/openhab/binding/wiz/internal/handler/WizHandler.java
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.wiz/src/main/resources/OH-INF/thing/thing-types.xml
Show resolved
Hide resolved
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 believe I'm through all files now. I have provided a few additional comments from this walk-through.
...g.openhab.binding.wiz/src/main/java/org/openhab/binding/wiz/internal/handler/WizHandler.java
Outdated
Show resolved
Hide resolved
...g.openhab.binding.wiz/src/main/java/org/openhab/binding/wiz/internal/handler/WizHandler.java
Outdated
Show resolved
Hide resolved
...g.openhab.binding.wiz/src/main/java/org/openhab/binding/wiz/internal/handler/WizHandler.java
Outdated
Show resolved
Hide resolved
...g.openhab.binding.wiz/src/main/java/org/openhab/binding/wiz/internal/handler/WizHandler.java
Outdated
Show resolved
Hide resolved
...nhab.binding.wiz/src/main/java/org/openhab/binding/wiz/internal/handler/WizMediatorImpl.java
Outdated
Show resolved
Hide resolved
...inding.wiz/src/main/java/org/openhab/binding/wiz/internal/utils/WizResponseDeserializer.java
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.wiz/src/main/resources/OH-INF/thing/thing-types.xml
Show resolved
Hide resolved
Just a little reminder if we want this in 4.3.0 we have about a week left as the feature freeze for 4.3.0 is in about a week. |
I'm hoping to have time tomorrow to look at the rest of the comments. |
@sfussenegger : what happens when you send 0 to the speed channel for a fan? Is it ignored? Is zero the lowest (but still moving) speed? If it's ignored, we should handle it as an OFF command. |
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 added as many of the prior authors as I could identify (including @frejos) as
Let's give @sfussenegger 24 hours to respond, and then merge if no response. If anything else comes up, it can be handled as a separate bug fix PR. |
No, that's perfectly fine, I just missed/forgot about that. Thanks! |
...hab.binding.wiz/src/main/java/org/openhab/binding/wiz/internal/utils/WizPacketConverter.java
Show resolved
Hide resolved
As far as I remember - and I'll re-check this evening - the command is simply ignored as 0 isn't a valid state (valid range is 1 to 6, at least for my model). Anything else you would need me to check or test? |
This binding integrates [WiZ Connected](https://www.wizconnected.com/en-US/) smart devices. This is a successor to the community marketplace version of this binding, most recently maintained by @frejos, bringing it up to date with openHAB guidelines and standards, to be part of the main distribution. User visible changes: * Renamed thing type, channel type, and channel ids to be `lower-case-hyphen` * Removed `wiz-` prefix from thing type ids * Removed `dimming` and `state` channels from `color-bulb` (use `color` channel) * Removed `state` channel from `tunable-bulb` (use `brightness` channel) * Removed `state` channel from `dimmable-bulb` (use `brightness` channel) * Renamed `fan-state` channel to just `state` * Renamed `dimming` channel to `brightness` * Renamed `light-mode` channel to just `mode` * Added `temperature-abs` channel * Fixed INCREASE/DECREASE to `speed` channel changing temperature * Set color temperature to UNDEF when not in color temp mode * Calculate the effective color when in color temp mode Internal changes: * Removed recreation of thing types based on binding version (openHAB core supports update instructions to handle this automatically) * Use PercentType.ZERO, PercentType.HUNDRED, DecimalType.ZERO as appropriate * Splits updates for fan and light apart, to reduce confusion * Remove lots of debugging-style logging * Address several compilation warnings Co-authored-by: Joshua Freeman <[email protected]> Co-authored-by: Stefan Fussenegger <[email protected]> Co-authored-by: Sara Damiano <[email protected]> Signed-off-by: Cody Cutrer <[email protected]>
Signed-off-by: Cody Cutrer <[email protected]>
Signed-off-by: Cody Cutrer <[email protected]>
Signed-off-by: Cody Cutrer <[email protected]>
Signed-off-by: Cody Cutrer <[email protected]>
by putting light and fan channels into groups. default discovery will detect fans as a fan-with-light, just like the WiZ app. a fan-only device will have to be manually created Signed-off-by: Cody Cutrer <[email protected]>
Signed-off-by: Cody Cutrer <[email protected]>
replace it with "device" where relevant, or just remove it completely as a prefix to the config options macAddress and ipAddress Signed-off-by: Cody Cutrer <[email protected]>
and remove extraneous debugging logging Signed-off-by: Cody Cutrer <[email protected]>
Signed-off-by: Cody Cutrer <[email protected]>
Signed-off-by: Cody Cutrer <[email protected]>
Signed-off-by: Cody Cutrer <[email protected]>
Signed-off-by: Cody Cutrer <[email protected]>
so don't bother stating them. still leave the falses (even the double false, which could technically just not have an @expose, to make it clear they're not part of the JSON) Signed-off-by: Cody Cutrer <[email protected]>
Signed-off-by: Cody Cutrer <[email protected]>
so a fan-only thing would need to be manually created Signed-off-by: Cody Cutrer <[email protected]>
since it's 1/2, not 0/1, and theoretically more could be added Signed-off-by: Cody Cutrer <[email protected]>
Signed-off-by: Cody Cutrer <[email protected]>
Number:Dimensionless with unit dB also mark last-update as advanced - most people don't care about it Signed-off-by: Cody Cutrer <[email protected]>
Signed-off-by: Cody Cutrer <[email protected]>
mostly adjusting error handling, especially wrt not being able to find openHAB's IP address or MAC address Signed-off-by: Cody Cutrer <[email protected]>
Signed-off-by: Cody Cutrer <[email protected]>
Signed-off-by: Cody Cutrer <[email protected]>
okay, I've added handling that command fan speed 0 sends an OFF command instead. and rebased to resolve a conflict in CODEOWNERS. I think we're ready to submit @jlaur |
just to confirm:
{"method":"setPilot","env":"pro","error":{"code":-32600,"message":"Invalid Request"}} going through the comments here I've also noticed that I've never provided the
{
"method": "getModelConfig",
"env": "pro",
"result": {
"ps": 1,
"pwmFreq": 200,
"pwmRange": [
0,
100
],
"wcr": 20,
"nowc": 1,
"cctRange": [
2700,
2700,
2700,
2700
],
"renderFactor": [
255,
0,
255,
255,
0,
0,
0,
0,
0,
0
],
"fanSpeed": 6,
"wizc1": {
"mode": [
0,
0,
0,
0,
0,
0,
0
]
},
"wizc2": {
"mode": [
0,
0,
0,
0,
0,
0,
0
]
}
}
} |
Thanks again. Now, you could add the binding's logo to the openHAB website. See https://www.openhab.org/docs/developer/addons/#add-your-add-on-s-logo-to-the-openhab-website |
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/wizlighting-binding-4-0-0-0-4-3-0-0/148164/23 |
This binding integrates WiZ Connected smart devices.
This is a successor to the community marketplace version of this binding, most recently maintained by @frejos, bringing it up to date with openHAB guidelines and standards, to be part of the main distribution.
User visible changes:
wiz
, instead ofwizlighting
, since they offer non-lighting smart devices as welllower-case-hyphen
wiz-
prefix from thing type idsdimming
andstate
channels fromcolor-bulb
(usecolor
channel)state
channel fromtunable-bulb
(usebrightness
channel)state
channel fromdimmable-bulb
(usebrightness
channel)fan-state
channel to juststate
dimming
channel tobrightness
light-mode
channel to justmode
bulbMacAddress
andbulbIpAddress
configuration parameters and properties to justmacAddress
andipAddress
temperature-abs
channelspeed
,reverse
, andmode
channelsfan-with-dimmable-bulb
type, for a device that has a fan and a bulb; this is how new fan devices are detected. Fan-only devices cannot be reliably detected, so if that's what you have, you'll need to create it manually.speed
channel changing temperatureUNDEF
when not in color temp modeInternal changes: