LightwaveRF - New LightwaveRF Binding

I have just uploaded a new version to Git.
Its a major change on how the polling is carried out.

@BenDWire should fix your issue.

You can set the brightness either by going to the outer edge on Colorpicker or reducing the brightness using HSB sliders. (lightwave restrictions here so temperature on colourpicker doesnt do anything)

This is now fixed

New Binding Version Available - Version 1.1.1

Various bug Fixes.

Account Parameter: electricityCost
set this to a whole number (pence) in order to use the new channels:
energyCost
powerCost

Channel energyReset
use this to reset the current energy usage, IE in rules to reset every month after logging a historical value

Channel voltageReset (Use with caution)
Occasionally the lightwave value is messed up and the only way to reset is to remove and readd the device in the app. This allows you to reset this value.
To use:
Turn the socket off
Flick the reset switch on then off
Power cycle the device using the reset channel switch.
The voltage should now be reset.

UPDATE
Version 1.1.2 added
Fixed update bug for linkplus

I had a go with 1.1.1 and the logs showed the account connected but never got anything back:

2020-02-21 16:11:30.399 [DEBUG] [rf.internal.handler.LWAccountHandler] - Checking Lightwave connection
2020-02-21 16:11:30.401 [DEBUG] [rf.internal.handler.LWAccountHandler] - Connection to Lightwave in tact
2020-02-21 16:11:34.302 [DEBUG] [rf.internal.handler.LWAccountHandler] - Initiate Polling
2020-02-21 16:11:34.304 [WARN ] [rf.internal.handler.LWAccountHandler] - Channel List For Updating Is Empty, rescheduling
2020-02-21 16:11:35.771 [DEBUG] [rf.internal.handler.LWAccountHandler] - Initiate Polling
2020-02-21 16:11:35.774 [WARN ] [rf.internal.handler.LWAccountHandler] - Channel List For Updating Is Empty, rescheduling

Then I tried 1.1.2 and the account is stuck on Initializing, and is throwing many more errors:

2020-02-21 17:12:59.741 [DEBUG] [rf.internal.handler.LWAccountHandler] - Initializing Lightwave account handler.
2020-02-21 17:12:59.755 [WARN ] [.lightwaverf.internal.UpdateListener] - Start Lightwave Login Process
2020-02-21 17:12:59.758 [WARN ] [.lightwaverf.internal.UpdateListener] - Get new token
2020-02-21 17:12:59.707 [hingStatusInfoChangedEvent] - 'lightwaverf:lightwaverfaccount:9243d05c' changed from UNINITIALIZED to INITIALIZING
2020-02-21 17:13:00.686 [DEBUG] [.lightwaverf.internal.UpdateListener] - token: <redacted>
2020-02-21 17:13:00.689 [WARN ] [.lightwaverf.internal.UpdateListener] - Connected to lightwave
2020-02-21 17:13:06.862 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception: 
java.lang.NullPointerException: null
	at org.openhab.binding.lightwaverf.internal.handler.LWAccountHandler.getDevices(LWAccountHandler.java:152) ~[?:?]
	at org.openhab.binding.lightwaverf.internal.handler.LWAccountHandler.initialConnect(LWAccountHandler.java:114) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_222]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_222]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) ~[?:1.8.0_222]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) ~[?: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]
2020-02-21 17:14:00.698 [DEBUG] [rf.internal.handler.LWAccountHandler] - Start periodic connection check
2020-02-21 17:14:00.706 [DEBUG] [rf.internal.handler.LWAccountHandler] - Checking Lightwave connection
2020-02-21 17:14:00.712 [DEBUG] [rf.internal.handler.LWAccountHandler] - Connection to Lightwave in tact

I hope that helps …

While I’m writing, can I add the Gen1 hub as a Thing? Is it a h21 device? (I tried on 1.1.1 but didn’t seem to get me anywhere!)

Ben

@BenDWire try this..
removed
i havnt integrated the gen 1 hub yet as didnt have the data. run discovery, add the hub (will be unknown device). then go to the thing and check the properties, it will list all the channels it supports. if you send me this i can add it to the binding

After updating to 1.1.3 it took 2 reboots before the account went online, but I’m stumbling at the “Run Discovery” step. As the logs show below, I think OpenHAB is tryng to discover in the background and failing. I then ran “smarthome:discovery start lightwaverf” in the console which threw the error on the last line.

Noob question - Am I doing the “Run DIscovery” correctly? I tried appending .discovery to the command, and also using “LightwaveRF” in case it’s case sensitive, but got nowhere.

If you can give me a few pointers as to what I’m doing wrong I’ll try again.

Thanks again for trying to get this working!

2020-02-22 01:35:43.984 [DEBUG] [rf.internal.handler.LWAccountHandler] - Initiate Polling
2020-02-22 01:35:43.986 [WARN ] [rf.internal.handler.LWAccountHandler] - Channel List For Updating Is Empty, rescheduling
2020-02-22 01:35:52.865 [DEBUG] [rf.internal.handler.LWAccountHandler] - Checking Lightwave connection
2020-02-22 01:35:52.867 [DEBUG] [rf.internal.handler.LWAccountHandler] - Connection to Lightwave in tact
2020-02-22 01:35:53.988 [DEBUG] [rf.internal.handler.LWAccountHandler] - Initiate Polling
2020-02-22 01:35:53.991 [WARN ] [rf.internal.handler.LWAccountHandler] - Channel List For Updating Is Empty, rescheduling
2020-02-22 01:35:58.957 [WARN ] [nternal.DiscoveryServiceRegistryImpl] - No discovery service for binding id 'lightwaverf' found!

@BenDWire apologies, seems there is a build problem in vscode that caused me to break discovery.
fixed here:

org.openhab.binding.lightwaverf-2.5.2-SNAPSHOT_1.1.4.jar.txt (60.0 KB)

It may be a cache issue you having to restart where the binding has had major change.

@Greigc try clearing the cache and restarting

@Greigc When you say under bindings you mean here:

And you got the latest version from git or couple of posts above? And if above you removed .txt extension yes..

@Greigc turn on debug logging, remove and re-add and check the logs. Should show up.

And your putting here:
usr/share/openhab2/addons

With 1.1.4 discovery is now working, but it still doesn’t find any channels:

2020-02-22 10:25:02.298 [DEBUG] [htwaverf.internal.LWDiscoveryService] - Start Discovery
2020-02-22 10:25:10.013 [DEBUG] [rf.internal.handler.LWAccountHandler] - Initiate Polling
2020-02-22 10:25:10.016 [WARN ] [rf.internal.handler.LWAccountHandler] - Channel List For Updating Is Empty, rescheduling
2020-02-22 10:25:19.552 [DEBUG] [rf.internal.handler.LWAccountHandler] - Checking Lightwave connection
2020-02-22 10:25:19.554 [DEBUG] [rf.internal.handler.LWAccountHandler] - Connection to Lightwave in tact
2020-02-22 10:25:20.018 [DEBUG] [rf.internal.handler.LWAccountHandler] - Initiate Polling
2020-02-22 10:25:20.020 [WARN ] [rf.internal.handler.LWAccountHandler] - Channel List For Updating Is Empty, rescheduling

My OH2 is running on a Pi which is sitting next to the Hub, both connected via a switch. I can use netcat to send a string to the hub which then responds as expected. I use its IP address rather than a name - does your binding need anything specific?
That said, I can use the WebApp (https://manager.lightwaverf.com/) to turn devices on and off, so I can’t think I’ve done anything obviously wrong.
Ben

It won’t find any channels as it’s not integrated, that’s why I need the properties from the thing to integrate it. If you send me this over I’ll add it in tonight.

Available Channels:

Please bear in mind that I’m very new to OpenHAB, so I don’t fully understand the terminology here! I think I’m in a catch 22 situation, as although I have added the LightwaveRF account, it doesn’t discover any ‘Things’. I can add a hub (devicetype 21) but of course the properties just list the h21 properties - not what we want.
How can I add a Thing that isn’t supported by the binding (i.e. the Gen1 Hub)?
I’m afraid I need a bit of hand-holding at this point as I’m going round in circles! If there are commands to type in the console please let me know and I’ll get the results back this evening.

Thanks Greig. Yes my account details are in OK, and the logs say that the “connection to Lightwave is in tact” (sic) so I assume all is well. It’s showing as online, but doesn’t find anything during discovery.

[ In a twist of fate I bought 4 wi-fi sockets today and have flashed them with Tasmota, so there may well be a Gen1 hub and a few plug-in sockets on eBay in the near future! ]

Do you have config files in addition to using Paper UI? I see that error when my .things file conflicts with the values entered in the UI. I usually delete the config file and rewrite it once everything is working.

I’ll try and fix the Gson dependency, I think this is a bug (sure I read somewhere) - I’ll have a look.

If you have added your account thing, you should now be able to got to inbox.
Then search for devices.
When it finds your gen one hub add it (unknown device)
Then go to the thing it creates (configuration / things)
Find the added thing and click on it.
Then click the show properties button and it should list the channels as per my screenshot. Send me this and I will integrate it
If they are running tasmota do they still show in the lightwave app? I’m not sure on this one

@BenDWire @Greigc just realized i deleted the unknown device accidentally whilst cleaning up the code, have just pushed 1.1.5 to git which will allow you to discover them and send me the properties

@delid4ve Tasmota is a totally different ecosystem to LightwaveRF, and use wi-fi to talk to an MQTT broker. I’ve got several lightbulbs that I’ve flashed with Tasmota and they work well. I only have 5 working LWRF devices now, so I’m at the point where I’m considering abandoning them. (I’m happy to help get the binding working before I do though!)

I’ll load up 1.1.5 later today.

Using 1.1.5 I could add an unknown device, and the logs show that all is not quite well yet. The properties of the new Thing don’t have any details, but at least they are showing the headings.

2020-02-23 12:00:23.940 [DEBUG] [averf.internal.handler.DeviceHandler] - Initializing lightwaverf:device handler.
2020-02-23 12:00:23.943 [DEBUG] [averf.internal.handler.DeviceHandler] - initializeBridge ONLINE for thing lightwaverf:device:94fe32ff
2020-02-23 12:00:23.986 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.initialize()' on 'org.openhab.binding.lightwaverf.internal.handler.DeviceHandler@e14d6': null
java.lang.NullPointerException: null
	at org.openhab.binding.lightwaverf.internal.handler.DeviceHandler.properties(DeviceHandler.java:131) ~[?:?]
	at org.openhab.binding.lightwaverf.internal.handler.DeviceHandler.initialize(DeviceHandler.java:80) ~[?:?]
	at sun.reflect.GeneratedMethodAccessor53.invoke(Unknown Source) ~[?:?]
	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]

2020-02-23 12:00:23.996 [ERROR] [core.thing.internal.ThingManagerImpl] - Exception occurred while initializing handler of thing 'lightwaverf:device:94fe32ff': null
java.lang.NullPointerException: null
	at org.openhab.binding.lightwaverf.internal.handler.DeviceHandler.properties(DeviceHandler.java:131) ~[?:?]
	at org.openhab.binding.lightwaverf.internal.handler.DeviceHandler.initialize(DeviceHandler.java:80) ~[?:?]
	at sun.reflect.GeneratedMethodAccessor53.invoke(Unknown Source) ~[?:?]
	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]

2020-02-23 12:00:23.909 [hingStatusInfoChangedEvent] - 'lightwaverf:device:94fe32ff' changed from UNINITIALIZED to INITIALIZING
2020-02-23 12:00:23.997 [hingStatusInfoChangedEvent] - 'lightwaverf:device:94fe32ff' changed from INITIALIZING to UNINITIALIZED (HANDLER_INITIALIZING_ERROR)

2020-02-23 12:00:32.686 [DEBUG] [rf.internal.handler.LWAccountHandler] - Initiate Polling
2020-02-23 12:00:32.688 [WARN ] [rf.internal.handler.LWAccountHandler] - Channel List For Updating Is Empty, rescheduling
2020-02-23 12:00:42.689 [DEBUG] [rf.internal.handler.LWAccountHandler] - Initiate Polling
2020-02-23 12:00:42.691 [WARN ] [rf.internal.handler.LWAccountHandler] - Channel List For Updating Is Empty, rescheduling

I understand that, but I’m not sure I have anything useful yet …

Aren’t you using a Gen2 hub though? I’m trying to get a Gen1 hub working, which uses a totally different way of going about things, hence the errors in the logs.

Every time I Dave releases a new .jar file I have to delete the lwrf things, clear the caches and start over anyway. (I’m runnning on a Pi with ZRAM so it’s a bit of a PITA!)

A gen1 hub doesn’t have a completely different way of doing things when used through the api.

You don’t have to delete everything every time, just clear the cache (stop openhab, delete tmp and cache from userdata)

@Greigc have just uploaded 1.1.6 - should now discover your gen1 dimmers. You’ll have to delete the unknown device things first. If you want to use in text config device code is d11, will add to Readme later
Let me know it works fine

@BenDWire I have just added a separate jar to git (appended bend), can you load this in and send me the debug log for ‘Structure:’ and ‘StructureList’ when it loads, should be a json string
Just to be clear aswell, you have an account in this app: (as there are two different ones)

Config files? You mean ‘things’ and ‘items’ files yes, not .cfg?
At the moment you can’t add text files as the hub isn’t integrated, you’ll need to add through discovery(paperui only)