Overhaul and rebmission of WiZ Lighting binding

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.

I don’t think there’s any way to downgrade the firmware on the bulbs, especially when it didn’t even tell you before upgrading them. It was working on bulb firmware 1.17.1 but in 1.18.0 they removed one of the parameters I was using from the get config command causing those null errors during set up. You can check your bulb firmware by going to the settings for the individual bulb and clicking on the bulb model name. I honestly only caught the change in firmware numbers because I had two bulbs that happened to be unpowered when the others updated.

No need to be sorry. Its not your fault that the upgrade broke your hard work!!!

HI Sara - echoing Paul’s comments, no need to be sorry - I can imagine how frustrating it is to have firmware changes break your hard work!

I’ve just checked my bulb from the app - the firmware version is 1.18.0 and the meodel ID is 6, so that seems to match your experience.

Unfortunately I’m no help with binding development, but very happy to help with testing when the next version of the binding is ready.

@SRGDamiano, strange thing, i noticed today that though i can still send commands to the bulbs and they will do the changes, i dont get an update back with current status. On paperUI they all show offline. Im guessing Wiz is tightening down on their code.

Hello, I have the binding installed. In the binding setup I have the IP of my openhab install, the mac of my openhab install, and an invite token from the integrations page (smartthings). I added a new bulb thing manually. It wont go online. Any clue?

@SRGDamiano

I have installed your binding. 2 issue I have run into. First, if you manually create the thing in a things file, the mac and ip do not get imported to paperui. Also, if you create the thing in paperui, there’re issues.

Regardless of which way I go, the device is always offline. I can see when I put “:” between the digits on the mac, the bulb will go online,then back off…it doesn’t save the mac address with the colons; and the bulb is expecting it to.

Basically, the bulbs need a real mac address, rather than one without the colons. Can you help here please.

EDIT: I looked in the jasondb things file after creation on the thing. It appears the update interval is missing quotes around it. Also, cant change the mac format here. As you can see, I added colons, but it wont save the file. I’m using winscp to access the pi, for the life of me,I cant get win10 to map the network drive, had to find another option to access the files.

When you get around (if it is possible) to update the binding, please post it here as I would be interested in trying it out. Thanks.

I too look forward to an updated binding. The Wiz lights look good and are well priced. I grabbed one of their old fashioned filament fancy bulbs to test.

I, too, am hoping an updated binding might be in the works. I’m new to OpenHAB and today installed the Wiz binding, only to find it was broken by a firmware update.

Many thanks to the OP for the effort!!

I’m sorry, I haven’t sat to work on anything with the binding since March.

I finally have an updated version for you: https://drive.google.com/file/d/1hG2RLskc7G-WXSwHjoO5nXWqizHsfx1q/view?usp=sharing

I’m not positive the errors are fixed; let me know how it works for you!

You shouldn’t use the colons. I think your errors were probably because back in March-ish WiZ changed their API very slightly which made one queries I was using to get information from the bulb start failing. Try the newer version and see if it works.

Hi Sara, Just tried you latest binding on a Wiz ST.B22led (single colour bulb).

  • It was not found automatically
  • I added it manually (puting in the MAC and IP addy) but it is marked as offline

Logs shows:

Openhab

2020-06-07 18:53:53.914 [ERROR] [nal.utils.WizLightingPacketConverter] - Error parsing json! com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 236 path $

Events

2020-06-07 18:53:53.270 [.ItemChannelLinkAddedEvent] - Link 'wizlighting_wizDimmableBulb_c704c560_state-wizlighting:wizDimmableBulb:c704c560:state' has been added.
2020-06-07 18:53:53.273 [.ItemChannelLinkAddedEvent] - Link 'wizlighting_wizDimmableBulb_c704c560_lightMode-wizlighting:wizDimmableBulb:c704c560:lightMode' has been added.
2020-06-07 18:53:53.275 [.ItemChannelLinkAddedEvent] - Link 'wizlighting_wizDimmableBulb_c704c560_speed-wizlighting:wizDimmableBulb:c704c560:speed' has been added.
2020-06-07 18:53:53.277 [.ItemChannelLinkAddedEvent] - Link 'wizlighting_wizDimmableBulb_c704c560_signalstrength-wizlighting:wizDimmableBulb:c704c560:signalstrength' has been added.
2020-06-07 18:53:53.279 [.ItemChannelLinkAddedEvent] - Link 'wizlighting_wizDimmableBulb_c704c560_lastUpdate-wizlighting:wizDimmableBulb:c704c560:lastUpdate' has been added.
2020-06-07 18:53:53.895 [hingStatusInfoChangedEvent] - 'wizlighting:wizDimmableBulb:c704c560' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to INITIALIZING
2020-06-07 18:53:53.897 [hingStatusInfoChangedEvent] - 'wizlighting:wizDimmableBulb:c704c560' changed from INITIALIZING to UNKNOWN
2020-06-07 18:53:53.914 [hingStatusInfoChangedEvent] - 'wizlighting:wizDimmableBulb:c704c560' changed from UNKNOWN to OFFLINE
2020-06-07 18:53:53.915 [me.event.ThingUpdatedEvent] - Thing 'wizlighting:wizDimmableBulb:c704c560' has been updated.
2020-06-07 18:57:24.759 [me.event.ThingUpdatedEvent] - Thing 'wizlighting:wizDimmableBulb:c704c560' has been updated.
2020-06-07 18:57:24.759 [hingStatusInfoChangedEvent] - 'wizlighting:wizDimmableBulb:c704c560' changed from OFFLINE to UNKNOWN
2020-06-07 18:57:24.773 [hingStatusInfoChangedEvent] - 'wizlighting:wizDimmableBulb:c704c560' changed from UNKNOWN to OFFLINE

Hm. I don’t have any single color bulbs. There must be something different about the API. Can you bump the logging level up to trace and post some of the output?

Here some debug info:

2020-06-08 08:13:50.557 [INFO ] [rnal.handler.WizLightingMediatorImpl] - IP of OpenHab device is 192.168.1.xxx.
2020-06-08 08:13:50.788 [INFO ] [rnal.handler.WizLightingMediatorImpl] - MAC Address of OpenHab device is 00FFxxxxx.
2020-06-08 08:13:51.095 [INFO ] [rnal.handler.WizLightingMediatorImpl] - IP of OpenHab device is 192.168.1.xxx.
2020-06-08 08:13:51.329 [INFO ] [rnal.handler.WizLightingMediatorImpl] - MAC Address of OpenHab device is 00FFxxxxx.
2020-06-08 08:13:51.329 [DEBUG] [nal.utils.WizLightingPacketConverter] - JSON Command: {"id":0,"method":"registration","params":{"phoneIp":"192.168.1.xx","register":true,"phoneMac":"00FFxxxxxx"}}
2020-06-08 08:13:51.330 [DEBUG] [iscovery.WizLightingDiscoveryService] - Sent packet to address: /192.168.4.231 and port 38899
2020-06-08 08:15:55.777 [DEBUG] [g.internal.WizLightingHandlerFactory] - Creating a new WizLightingHandler...
2020-06-08 08:15:56.054 [INFO ] [rnal.handler.WizLightingMediatorImpl] - IP of OpenHab device is 192.168.1.xxxx.
2020-06-08 08:15:56.289 [INFO ] [rnal.handler.WizLightingMediatorImpl] - MAC Address of OpenHab device is 00FFxxxx.
2020-06-08 08:15:56.290 [DEBUG] [g.internal.WizLightingHandlerFactory] - WizLightingMediator will register the handler.
2020-06-08 08:15:56.295 [INFO ] [.internal.handler.WizLightingHandler] - WiZ lighting binding has been updated.
2020-06-08 08:15:56.295 [INFO ] [.internal.handler.WizLightingHandler] - Current version is v0.02.06, prior version was null.
2020-06-08 08:15:56.308 [DEBUG] [g.internal.WizLightingHandlerFactory] - Creating a new WizLightingHandler...
2020-06-08 08:15:56.665 [INFO ] [rnal.handler.WizLightingMediatorImpl] - IP of OpenHab device is 192.168.1.xxxxx.
2020-06-08 08:15:56.882 [INFO ] [rnal.handler.WizLightingMediatorImpl] - MAC Address of OpenHab device is 00FFxxxxx.
2020-06-08 08:15:56.883 [DEBUG] [g.internal.WizLightingHandlerFactory] - WizLightingMediator will register the handler.
2020-06-08 08:15:56.885 [DEBUG] [nal.utils.WizLightingPacketConverter] - JSON Command: {"id":0,"method":"getSystemConfig"}
2020-06-08 08:15:56.886 [DEBUG] [.internal.handler.WizLightingHandler] - Sent packet to address: /192.168.1.xxx and port 38899
2020-06-08 08:15:56.903 [DEBUG] [nal.utils.WizLightingPacketConverter] - Incoming packet from 192.168.1.xxx to convert -> {"method":"getSystemConfig","env":"pro","result":{"mac":"a8bb5xxxxxx","homeId":10xxxxx,"roomId":15xxxxx,"homeLock":false,"pairingLock":false,"typeId":0,"moduleName":"ESP56_SHTW3_01","fwVersion":"1.18.3","groupId":0,"drvConf":[20,1]}}
2020-06-08 08:15:56.904 [ERROR] [nal.utils.WizLightingPacketConverter] - Error parsing json! com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 236 path $
2020-06-08 08:15:56.904 [DEBUG] [.internal.handler.WizLightingHandler] - No response to registration request from bulb at 192.168.1.xx - a8:bb:xx:xx:xx:xx
2020-06-08 08:15:56.905 [DEBUG] [.internal.handler.WizLightingHandler] - Finished initialization for bulb at 192.168.1.xx - a8:bb:xx:xx:xx:xx
2020-06-08 08:15:58.356 [DEBUG] [.internal.handler.WizLightingHandler] - Bulb at 192.168.1.xx - a8:bb:xx:xx:xx:xx is offline.  Will not query for status until a firstBeat is received.

There seems to be two issues:

  • The discovery is trying to use 192.168.4.231 (which is not on my network)
  • When I add the bulb manually there is a parsing issue

Thanks
Nathan