LightwaveRF - New LightwaveRF Binding

Tags: #<Tag:0x00007fc1fbd8df00> #<Tag:0x00007fc1fbd8de10>
[username="example@hotmail.co.uk",password="xxxxxx",pollingInterval=5,pollingGroupSize=20

It doesnt matter, it only picks up each sdId (which is the number between the two hyphens in the full deviceId) had to keep it simple for text based. It will only discover 1 of each of these, which is why i believe there to be some form glith with your ‘managed things’.

This is mine so you can adopt, have changed some deviceIds so you can see.

Bridge lightwaverf:lightwaverfaccount:benfleet "Lightwave Account" @ "Cupboard" [ username="example@hotmail.co.uk", password="xxxxxxx",pollingInterval=5,pollingGroupSize=30] {

h21 	LightwaveHub	"Link Plus" @ "Cupboard"                        [ sdId="1" ]
s22 	KitchenSocket1 	"Kitchen Alexa & Toaster" @ "Kitchen"		    [ sdId="31" ]
s22 	KitchenSocket2 	"Kitchen Spare & Kettle" @ "Kitchen"		    [ sdId="26" ]
s22 	KitchenSocket3 	"Kitchen TV & TV Light" @ "Kitchen"		        [ sdId="4" ]
s22 	KitchenSocket4 	"Kitchen Breakfast Bar" @ "Kitchen"		        [ sdId="5" ]
s22 	GeorgesSocket1 	"George TV & Lamp" @ "George"			        [ sdId="11" ]
s22 	KitchenSocket5 	"Kitchen Microwave & Cupboard" @ "Kitchen"	    [ sdId="12" ]
s22 	LoungeSocket1 	"Lounge Chair" @ "Lounge"			            [ sdId="13" ]
s22 	LoungeSocket2 	"Lounge Stereo & Nintendo Switch" @ "Lounge"	[ sdId="14" ]
s22 	LoungeSocket3 	"Lounge Network Switch & TV" @ "Lounge"		    [ sdId="15" ]
	
}

bear in mind your bridge and device names so you dont have to change all your item channels:
ie:
KitchenSocket1 from the device thing and benfleet from account thing are in the channel:

{ channel="lightwaverf:s22:benfleet:KitchenSocket1:2#switch" }

Also, you could try deleting your account thing and 1 of the things that shows up as duplicate.
Then check that they are definitely not there.
Re-add your account thing and then check its properties.
Then readd the single device thing you deleted.

When I alter it to (anything less than 20 on the pollingGroupSize)

,pollingInterval=5,pollingGroupSize=5

I get the following and it all goes to BRIDGE_UNINITIALIZED

java.lang.IllegalArgumentException: fromIndex(5) > toIndex(0)
        at java.util.ArrayList.subListRangeCheck(ArrayList.java:1014) ~[?:1.8.0_232]
        at java.util.ArrayList.subList(ArrayList.java:1004) ~[?:1.8.0_232]
        at org.openhab.binding.lightwaverf.internal.handler.LWAccountHandler.pollingSize(LWAccountHandler.java:205) ~[?:?]
        at org.openhab.binding.lightwaverf.internal.handler.LWAccountHandler.startRefresh(LWAccountHandler.java:280) ~[?:?]
        at org.openhab.binding.lightwaverf.internal.handler.LWAccountHandler.initialize(LWAccountHandler.java:87) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_232]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_232]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_232]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_232]
        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_232]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_232]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_232]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_232]
2020-02-14 15:57:18.932 [ERROR] [core.thing.internal.ThingManagerImpl] - Exception occurred while initializing handler of thing 'lightwaverf:lightwaverfaccount:alex': fromIndex(5) > toIndex(0)
java.lang.IllegalArgumentException: fromIndex(5) > toIndex(0)
        at java.util.ArrayList.subListRangeCheck(ArrayList.java:1014) ~[?:1.8.0_232]
        at java.util.ArrayList.subList(ArrayList.java:1004) ~[?:1.8.0_232]
        at org.openhab.binding.lightwaverf.internal.handler.LWAccountHandler.pollingSize(LWAccountHandler.java:205) ~[?:?]
        at org.openhab.binding.lightwaverf.internal.handler.LWAccountHandler.startRefresh(LWAccountHandler.java:280) ~[?:?]
        at org.openhab.binding.lightwaverf.internal.handler.LWAccountHandler.initialize(LWAccountHandler.java:87) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_232]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_232]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_232]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_232]
        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_232]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_232]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_232]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_232]

@xela - Ive just checked.
Its something to do with the initialization, doesnt matter what the number is, its the fact its been changed.
Will try and have a look later.

That’s not what I was seeing, if I changed it to anything less than 20 it failed, anything greater than it went to unitialized but went online after.

I’m playing with dimSetup at the moment, but will provide some more details once I’ve finished breaking that :slight_smile:

I think i have found the issue.
ill get rid of it shortly, was this a stress test only… as i don’t think you really want to set it that low… 20-40 is ideal

Yes, I do some testing at work, so attempt to break things deliberately :slight_smile:

Ok, I’ve done some investigation on dimSetup, as predicted, it’s related to Calibration.

When already calibrated, it seems to have a value of 113868800

You seem to be able to set this to any value above 0 and it doesn’t seem to do anything

If you set it to 0, then it force a recalibration.

I’m not sure how you would code this, I assume maybe a fake switch that sets it to 0 if turned on?

EDIT: doesn’t always seem to be 113868800, one I’ve not played with is 136839168, another is 134955008, I assume it’s something to do with the result of the calibration, but changing it manually seems to have no impact on the dimmability of the bulbs

bulbSetup is a number based upon the settings in the app for the switch, from what I can tell it’s loosely calculated on the following:

  • Total number of lamps controlled by switch
  • The wattage of each lamp controlled by the switch

image

Not sure it’s of much use in OpenHAB at present?

EDIT: forgot to add, the app states these figures ‘help us calibrate the energy monitoring capabilities of this device’

Running 1.0.8 anyone else have an issue where if you change the dimlevel the slider returns to 100 but the light is at the new selected level?

I’m having issues adjusting Brightness on sockets led, also running 1.0.8, slider returns to 100 and nothing changes

Can I ask a very basic question? It looks as if this new binding uses the lightwaverf cloud server to do all the heavy lifting, so if I only want to use my Gen1 hub as a local controller then is this new binding overkill? It seems the original binding is exactly what I want, but as I’m trying to only use OH2 bindings then that’s not an option for me. Does anyone have a view on this?

(I do have a stop-gap solution using netcat commands that seems to work for me, but it’s a hard-coded bodge!)

This indeed uses the cloud servers as any gen2 stuff is only controllable this way. Although integration is available for gen1 equipment using the cloud.

You would have to carry on using the v1 binding if it’s just gen1 equipment you have and want local control.

@BenDWire
Could you do me a favour.
Add the binding
Add your account
Discover devices and add them.
Go to each device in paperui (different types) and send me what it lists under properties
I’m only concerned for gen1 hub and everything else gen1 not (single socket/energy monitor/thermostat)

I can’t promise anything but I’ll take a look at a possible gen1/gen2 split time keep gen1 hubs local

Thanks Dave - I suspected that was the case. My experience with the hardware has been less than favourable anyway, with a few sockets going faulty despite having very little load applied, so I may well cut my losses and switch to a WiFi solution instead.

I’ve had my gen2 sockets in for about 2 years now (1st batch), and touch wood I’ve not had a blip yet

Sorry - our replies crossed!
My biggest problem is that I use a PiHole to block all my local IoT stuff from leaking out into the cloud. I did disable it and try to use the binding with no success. I’ll give it another go and report back.

OK, so I deleted my configuration files from my previous attempts (.things & .items) and added the 1.0.8 binding once again. I added my (correct!) account details but ended up with UNINITIALIZED - HANDLER_INITIALIZING_ERROR for the LightwaveRF Account Thing. According to the log, I am “connected to lightwave” but when the List Generation was started it threw an error while calling ThingHandler.initialise(). Debug log shown below.

12:06:29.037 [WARN ] [g.lightwaverf.internal.UpdateListener] - Connected to lightwave
12:06:29.044 [DEBUG] [erf.internal.handler.LWAccountHandler] - Started List Generation
12:06:29.350 [ERROR] [rnal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.initialize()' on 'org.openhab.binding.lightwaverf.internal.handler.LWAccountHandler@8fac75': null
java.lang.NullPointerException: null
	at org.openhab.binding.lightwaverf.internal.handler.LWAccountHandler.createLists(LWAccountHandler.java:112) ~[?:?]
	at org.openhab.binding.lightwaverf.internal.handler.LWAccountHandler.initialize(LWAccountHandler.java:83) ~[?:?]
	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]
12:06:29.371 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'lightwaverf:lightwaverfaccount:c3e53c09' changed from INITIALIZING to UNINITIALIZED (HANDLER_INITIALIZING_ERROR)
12:06:29.372 [ERROR] [.core.thing.internal.ThingManagerImpl] - Exception occurred while initializing handler of thing 'lightwaverf:lightwaverfaccount:c3e53c09': null
java.lang.NullPointerException: null
	at org.openhab.binding.lightwaverf.internal.handler.LWAccountHandler.createLists(LWAccountHandler.java:112) ~[?:?]
	at org.openhab.binding.lightwaverf.internal.handler.LWAccountHandler.initialize(LWAccountHandler.java:83) ~[?:?]
	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]

I ought to add that my Gen1 hub firmware version is U2.94D, just in case that matters, and I’m running OpenHAB 2.5.1

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