Overhaul and rebmission of WiZ Lighting binding

I picked up an old PR for support for WiZ Connected lighting bulbs and overhauled it and think I have everything working. I’ve submitted a PR here: https://github.com/openhab/openhab-addons/pull/6790

Here’s the jar: https://drive.google.com/file/d/1cNYgh734RFMb-WgAS6Defl5Pb7pj1lyz/view?usp=sharing

I’d really appreciate any testing and comments!

2 Likes

Hi SRGDamiano . I just dipped my feet into the world of open source automation with openhab2 last week and Im really digging it. So far I learned to flash all my tuya devices with tasmota and got my house bulbs all set up. BUT Ive got two recessed lights I installed that are wiz ( couldnt resist the price at homedepo) and this is the fist article i find with hopes of bringing them into my new openhab2 environment. Thing is, I dont have a clue what I would even do with the .jar file. If you can nudge me in the right direction, Ill get these lights set up on openhab and Ill be happy to provide feedback on the experience. Thanks for your help!

Have you figured out how to log onto your OpenHab server so that you can see the directories with your configuration files? I use Visual Studio Code’s SSH explorer to log onto my Raspberry Pi running OpenHabian.

Once you can see the directories on your OpenHab server, find the /srv/openhab2-addons folder. Copy and paste the jar file into that directory. Once the jar is in the directory you can use PaperUI to discover, add, and edit the bulbs.

Do you have full color bulbs, tunable white, or dimmable ones? I only have the full color ones, so that’s all it has been tested on. If you have any others, I would really particularly appreciate it if you could go to “Show Properties” when editing the bulb in PaperUI and tell me the moduleName that appears.

Ive got the color/ tunable white Recessed lighting bulbs from Home Depo. After I sent you the original message I threw the .jar in that directory thinking maybe it was that easy but then I had to move on to something else and forgot about it. The next day i went into open hab and noticed my 2 wiz devices ready to be discovered! At first glance the worked great, i didn’t have any trouble getting them to connect but i soon I noticed i could only truly control the white color (warm and cool) and brightness functionality. when id try to control colors i could get a reddish color but thats about it. This worked about 2 days then a few nights ago I noticed the weren’t responding anymore. I checked through amazon (via wiz skill) and through wiz app directly, and they were controllable there.

Also, i realized late on that I was now possibly sending commands to the lights twice, once through alexa via wiz skill, and also through Alexa via openhab skill, so maybe that did something I don’t know.
At this point, they are controllable through the wiz app but i disabled wiz skill, and re-added the lights on openhab but have not been able to control them on openhab anymore. Still, it was exciting to have all my house lights finally working together for the last few days. Hope the properties info help you out. I included a screenshot of the properties info for you. If you have any suggestion for what may have happened to stop them from working, id be happy to give it a try.

Well, I rebooted openhab, re added the lights and it seems they are working again. :slight_smile:

To clarify, the white works and is tunable from warm to cool

colors still dont work, when i move the color on control, i see 400- bad request at bottom and can only see red color on lights.

Yes, I can’t quite seem to get the colors right. I thought I had it working, but it’s not quite right (except for red).

The color input for them is different from any others I’ve found in openhab (or Google) because there are 5 colors of led (rgb plus warm white plus cool white) and they’re all controlled independently and then the dimming is yet another channel. Essentially all the examples I’ve seen have only 3 channels (rgb, hsb=hsv, hsi, or xyz). These have 6. I’m trying to replicate the way the app sets the colors, but I can’t quite get it right.I’ve been playing with it this weekend, I’ll post the latest version, but it still isn’t perfect.

Here’s a link to the latest jar: https://drive.google.com/open?id=1-4Zqw6-s5GZfYuSDxp1KusQTHJ7JUMCC

With this I can get the light to be any color at 100% saturation, but as soon as you touch the saturation it might revert to a very slightly tinted white. I also added a separate channel for the brightness, so you can control the brightness either along with color in the color picker, or by itself just as brightness. I did that because the bulb operates in either color mode or temperature mode and without brightness in a separate channel you would couldn’t change the brightness while in temperature mode.

To get the new channel you have to delete and re-add the things. If you don’t delete your channel links and items, hopefully they’ll re-link themselves as soon as you re-add the things.

There are some tuya bulbs that have 5 channels. I flashed some to Tasmota last week. I have the jeeo bulbs, I added the Modules to Tasmota list. They have 5 channels that sound like what you’re saying. Maybe that helps.

https://github.com/arendst/Tasmota/wiki/Lights

https://templates.blakadder.com/

I redid the coloring following the Tasmota style. I think it’s doing much better now: https://drive.google.com/open?id=1clCs1cyaKmkcyZImMUs8oJklcpL6_89r

Hi Damiano,

first of all thanks for sharing your job. I would like try your binding with the new gen2 color gu 10. Do you think the binding will work?

Thanks
Maria

I would guess that if the bulb uses the WiZ app it should work with the binding. You definitely need to do the initial set up with the WiZ app, and then the binding should be able to find the bulbs with the “scan” in paper ui.

Please let me know if it doesn’t work.

Ok thanks for the tip I’ll have a try as soon I receive one sample and I let you know. Another info that I didn’t find reading some post is the folder location where the file wizlighting.token should be placed. I have seen talking about userdata that as far as I know is identified by the following path /bar/lib/openhab2 . Does it to place under the root of that path or in other sub folder? Thank you

You must be looking at old documentation. The token file is not used at all.

@SRGDamiano Just a quick update, Ive been using your binding for a few weeks now and its great. I now have all wiz bulbs, ditched the tasmota bulbs, they were not as reliable as wiz. I bought some color bulbs from Cosco, module name shows as ESP05_SHRGBL_21 and they also work great, now I’ve got a total of 12 wiz color bulbs and 5 recessed wiz lights.

One minor thing i noticed is that with tasmota bulbs i am able to set temperature color to bulbs when they are powered off (not physically powered off) but with the wiz bulbs, making that change turns them on if they were off. Ex: I have a global group for light temperature i use to set the homes light temperature and with tasmota bulbs, if i have a light in a room I have set to off, when i change temperature color that light will not turn on but when i go to turn it on, it will show the temperature I’ve set in global. Ive noticed this isn’t possible with the wiz lights.

Besides that, this binding so far has been so easy and straightforward. If theres anything i can do to help with testing, just let me know.

I don’t think it’s possible to send the bulbs a new color temperature without turning them on. I’ll look into it.

I want to know how are you building or compiling these jar files, cause i am interested in it.

I’m using the open jdk and java tools in VSCode to build, but you should be able to use eclipse and any jdk.

Hi @SRGDamiano - thanks very much for making this binding!

Unfortunately, I’m having trouble getting it to work with my current OpenHAB set-up. I’ve installed the latest version of the .jar you referenced in your post on Jan 27 by putting it in the /src/openhab2-addons folder on my openHAB machine. The binding shows up in PaperUI and I’m able to scan for new things.

I’ve got a WiZ warm white dimmable bulb that I’ve set up and verified as working through the WiZ app.

Unfortunately the bulb hasn’t shown up in the inbox after a few hours, so I set up a thing manually using the MAC and IP addresses for the bulb I found from my router. Sadly, this results in a “UNINITIALIZED - HANDLER_INITIALIZING_ERROR” status for the thing, and the system logs show:

2020-04-09 09:56:29.591 [INFO ] [rnal.handler.WizLightingMediatorImpl] - IP of OpenHab device is 192.168.1.130.

2020-04-09 09:56:29.601 [INFO ] [rnal.handler.WizLightingMediatorImpl] - Mac Address of OpenHab device is CA9B8590ECE5.

2020-04-09 09:56:29.611 [INFO ] [rnal.handler.WizLightingMediatorImpl] - IP of OpenHab device is 192.168.1.130.

2020-04-09 09:56:29.617 [INFO ] [rnal.handler.WizLightingMediatorImpl] - Mac Address of OpenHab device is CA9B8590ECE5.

2020-04-09 09:59:40.515 [INFO ] [rnal.handler.WizLightingMediatorImpl] - IP of OpenHab device is 192.168.1.130.

2020-04-09 09:59:40.520 [INFO ] [rnal.handler.WizLightingMediatorImpl] - Mac Address of OpenHab device is CA9B8590ECE5.

2020-04-09 09:59:40.526 [INFO ] [.internal.handler.WizLightingHandler] - Bulb Mac Address set to 'a8:bb:50:0a:0e:24'

2020-04-09 09:59:40.529 [INFO ] [.internal.handler.WizLightingHandler] - Bulb IP Address set to '192.168.1.3'

==> /var/log/openhab2/events.log <==

2020-04-09 09:59:40.542 [hingStatusInfoChangedEvent] - 'wizlighting:wizDimmableBulb:0a616eed' changed from UNINITIALIZED to INITIALIZING

2020-04-09 09:59:40.587 [hingStatusInfoChangedEvent] - 'wizlighting:wizDimmableBulb:0a616eed' changed from INITIALIZING to UNKNOWN

==> /var/log/openhab2/openhab.log <==

2020-04-09 09:59:40.731 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.initialize()' on 'org.openhab.binding.wizlighting.internal.handler.WizLightingHandler@94309b': null

java.lang.NullPointerException: null

	at org.openhab.binding.wizlighting.internal.utils.WizResponseDeserializer.deserialize(WizResponseDeserializer.java:61) ~[?:?]

	at org.openhab.binding.wizlighting.internal.utils.WizResponseDeserializer.deserialize(WizResponseDeserializer.java:1) ~[?:?]

	at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:69) ~[bundleFile:?]

	at com.google.gson.Gson.fromJson(Gson.java:888) ~[bundleFile:?]

	at com.google.gson.Gson.fromJson(Gson.java:853) ~[bundleFile:?]

	at com.google.gson.Gson.fromJson(Gson.java:802) ~[bundleFile:?]

	at com.google.gson.Gson.fromJson(Gson.java:774) ~[bundleFile:?]

	at org.openhab.binding.wizlighting.internal.utils.WizLightingPacketConverter.transformResponsePacket(WizLightingPacketConverter.java:84) ~[?:?]

	at org.openhab.binding.wizlighting.internal.handler.WizLightingHandler.sendRequestPacket(WizLightingHandler.java:490) ~[?:?]

	at org.openhab.binding.wizlighting.internal.handler.WizLightingHandler.updateBulbProperties(WizLightingHandler.java:535) ~[?:?]

	at org.openhab.binding.wizlighting.internal.handler.WizLightingHandler.initialize(WizLightingHandler.java:339) ~[?:?]

	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_222]

	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_222]

	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_222]

	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_222]

	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:152) [bundleFile:?]

	at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]

	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_222]

	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_222]

	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_222]

	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]

==> /var/log/openhab2/events.log <==

2020-04-09 09:59:40.769 [hingStatusInfoChangedEvent] - 'wizlighting:wizDimmableBulb:0a616eed' changed from UNKNOWN to UNINITIALIZED (HANDLER_INITIALIZING_ERROR)

==> /var/log/openhab2/openhab.log <==

2020-04-09 09:59:40.770 [ERROR] [core.thing.internal.ThingManagerImpl] - Exception occurred while initializing handler of thing 'wizlighting:wizDimmableBulb:0a616eed': null

java.lang.NullPointerException: null

	at org.openhab.binding.wizlighting.internal.utils.WizResponseDeserializer.deserialize(WizResponseDeserializer.java:61) ~[?:?]

	at org.openhab.binding.wizlighting.internal.utils.WizResponseDeserializer.deserialize(WizResponseDeserializer.java:1) ~[?:?]

	at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:69) ~[bundleFile:?]

	at com.google.gson.Gson.fromJson(Gson.java:888) ~[bundleFile:?]

	at com.google.gson.Gson.fromJson(Gson.java:853) ~[bundleFile:?]

	at com.google.gson.Gson.fromJson(Gson.java:802) ~[bundleFile:?]

	at com.google.gson.Gson.fromJson(Gson.java:774) ~[bundleFile:?]

	at org.openhab.binding.wizlighting.internal.utils.WizLightingPacketConverter.transformResponsePacket(WizLightingPacketConverter.java:84) ~[?:?]

	at org.openhab.binding.wizlighting.internal.handler.WizLightingHandler.sendRequestPacket(WizLightingHandler.java:490) ~[?:?]

	at org.openhab.binding.wizlighting.internal.handler.WizLightingHandler.updateBulbProperties(WizLightingHandler.java:535) ~[?:?]

	at org.openhab.binding.wizlighting.internal.handler.WizLightingHandler.initialize(WizLightingHandler.java:339) ~[?:?]

	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_222]

	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_222]

	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_222]

	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_222]

	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:152) [bundleFile:?]

	at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]

	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_222]

	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_222]

	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_222]

	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]

Do you have any suggestions how I can fix this issue?

For reference, this system is openHAB 2.5.3-1 running on an openHABian installation on a Pine64 SBC.

Hi

I’m having the exact same problem with the exact same file. I had it working for a few weeks the it just stopped. I did do an upgrade so I downgraded, still the problem persists. I’m running ubunto 18.04 on an older laptop I had kicking around.

Just for kicks I set up a stable openhab on a VM and still it does not work. Same errors.

Oh! I’m so sorry, WiZ seems to have just pushed out a new firmware (as in, within the last three or four days) that changes some of the responses slightly. I haven’t gotten a chance to adjust for it yet. The WiZ app doesn’t notify you that it’s updating the firmware so I had no idea until half my bulbs stopped talking to openhab. I’ve started making the changes but it will be the weekend before I get to polishing it.