LightwaveRF Binding Updated

I done some more research yesterday and am in the process of changing the way the items are discovered and the way the json is parsed. This should factor in everyone’s different setups and is a lot cleaner in the way it processes the data to set it all up. I will probably get this up by Friday evening (uk).

Tried your latest file and still didn’t fly I’m afraid. Still getting the ‘null’ error:

2019-05-09 20:18:23.176 [INFO ] [eclipse.smarthome.model.script.Exec6] -
2019-05-09 20:18:24.232 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘LightWave_Items_Authentication.items’
2019-05-09 20:18:30.988 [vent.ItemStateChangedEvent] - Refresh_Token changed from NULL to aXXXXXXXXXXXXXXXXXX4
2019-05-09 20:18:30.990 [vent.ItemStateChangedEvent] - Access_Token changed from NULL to eyXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX8f27
2019-05-09 20:18:45.497 [INFO ] [eclipse.smarthome.model.script.Exec7] -
2019-05-09 20:18:45.834 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘LightWave_Rules_Authentication.rules’
2019-05-09 20:18:45.966 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘Lightwave_Setup’: For input string: “{nullHub”,“gen”:2}]}"
2019-05-09 20:18:47.346 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘LightWave_Rules_Authentication.rules’
2019-05-09 20:18:53.221 [vent.ItemStateChangedEvent] - Refresh_Token changed from aXXXXXXXXXXXXXXXXXXXX4 to d6XXXXXXXXXXXXXXXXXXa9
2019-05-09 20:18:53.228 [vent.ItemStateChangedEvent] - Access_Token changed from eyXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXIALc

I will put some log entries into the rule and see what I can capture

Okay, I added two lines to write to the log as follows:

//Get Items And Features
var String Access_Token = Access_Token.state.toString
val deviceresults = executeCommandLine(“curl@@-g@@-XGET@@https://publicapi.lightwaverf.com/v1/Structure/” + Structure.state.toString + “@@-H@@Authorization:bearer " + Access_Token,5000)
loginfo(“deviceresults”,deviceresults.toString)
var String LightWaveJSON = “{” + deviceresults.substringBetween(”{“,“Hub","gen":2}]}”) + “Hub","gen":2}]}”
logInfo(“LightwaveJSON”,LightwaveJSON.toString)
var Number t = Float.valueOf(transform(“JSONPATH”,”$.devices.length()", LightWaveJSON)) * 2 -1
var Number i = 1
var Number a = 0
var Number b = 0

This is what comes back:

2019-05-09 20:36:49.153 [INFO ] [smarthome.model.script.deviceresults] - % Total % Received % Xferd Average Speed Time Time Time Current

                             Dload  Upload   Total   Spent    Left  Speed

0 0 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0{“name”:“My Group”,“groupId”:“5a6a3fbfc211836b17f98f26-5a6a3fbfc211836b17f98f27”,“devices”:[{“deviceId”:“5a6a3fbfc211836b17f98f26-1-3157328472+0”,“name”:“LinkPlus”,“productCode”:“L2”,“featureSets”:[{“featureSetId”:“5a6a3fbfc211836b17f98f26-5a6a3fbfc211836b17f98f2d”,“name”:“LinkPlus”,“features”:[{“featureId”:“5a6a3fbfc211836b17f98f26-1-3157328472+0”,“type”:“currentTime”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-2-3157328472+0”,“type”:“buttonPress”,“writable”:false},{“featureId”:“5a6a3fbfc211836b17f98f26-3-3157328472+0”,“type”:“time”,“writable”:false},{“featureId”:“5a6a3fbfc211836b17f98f26-4-3157328472+0”,“type”:“date”,“writable”:false},{“featureId”:“5a6a3fbfc211836b17f98f26-5-3157328472+0”,“type”:“monthArray”,“writable”:false},{“featureId”:“5a6a3fbfc211836b17f98f26-6-3157328472+0”,“type”:“weekdayArray”,“writable”:false},{“featureId”:“5a6a3fbfc211836b17f98f26-7-3157328472+0”,“type”:“timeZone”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-8-3157328472+0”,“type”:“locationLongitude”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-9-3157328472+0”,“type”:“locationLatitude”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-10-3157328472+0”,“type”:“duskTime”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-11-3157328472+0”,“type”:“dawnTime”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-12-3157328472+0”,“type”:“rgbColor”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-112-3157328472+0”,“type”:“day”,“writable”:false},{“featureId”:“5a6a3fbfc211836b17f98f26-113-3157328472+0”,“type”:“month”,“writable”:false},{“featureId”:“5a6a3fbfc211836b17f98f26-114-3157328472+0”,“type”:“year”,“writable”:false},{“featureId”:“5a6a3fbfc211836b17f98f26-119-3157328472+0”,“type”:“weekday”,“writable”:false}]}],“product”:“L2”,“device”:“LinkPlus”,“desc”:“Central Hub”,“type”:“lwrfTwoWay_v2”,“cat”:“Hub”,“gen”:2},{“deviceId”:“5a6a3fbfc211836b17f98f26-4-3157328472+0”,“name”:“Test”,“productCode”:“L42”,“featureSets”:[{“featureSetId”:“5a6a3fbfc211836b17f98f26-5a6f8129f97b651e2d50edff”,“name”:“Internet”,“features”:[{“featureId”:“5a6a3fbfc211836b17f98f26-32-3157328472+0”,“type”:“switch”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-33-3157328472+0”,“type”:“outletInUse”,“writable”:false},{“featureId”:“5a6a3fbfc211836b17f98f26-34-3157328472+0”,“type”:“protection”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-35-3157328472+0”,“type”:“power”,“writable”:false},{“featureId”:“5a6a3fbfc211836b17f98f26-36-3157328472+0”,“type”:“energy”,“writable”:false},{“featureId”:“5a6a3fbfc211836b17f98f26-25-3157328472+0”,“type”:“identify”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-26-3157328472+0”,“type”:“reset”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-27-3157328472+0”,“type”:“upgrade”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-28-3157328472+0”,“type”:“diagnostics”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-29-3157328472+0”,“type”:“periodOfBroadcast”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-30-3157328472+0”,“type”:“rgbColor”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-31-3157328472+0”,“type”:“voltage”,“writable”:false}]},{“featureSetId”:“5a6a3fbfc211836b17f98f26-5a6f8129f97b651e2d50ee00”,“name”:“TV Socket”,“features”:[{“featureId”:“5a6a3fbfc211836b17f98f26-37-3157328472+0”,“type”:“switch”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-38-3157328472+0”,“type”:“outletInUse”,“writable”:false},{“featureId”:“5a6a3fbfc211836b17f98f26-39-3157328472+0”,“type”:“protection”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-40-3157328472+0”,“type”:“power”,“writable”:false},{“featureId”:“5a6a3fbfc211836b17f98f26-41-3157328472+0”,“type”:“energy”,“writable”:false}]}],“product”:“L42”,“device”:“socket”,“desc”:“Smart Socket”,“type”:“lwrfTwoWay_v2”,“cat”:“Power”,“gen”:2},{“deviceId”:“5a6a3fbfc211836b17f98f26-11-3157328472+0”,“name”:“Test3”,“productCode”:“LW320”,“featureSets”:[{“featureSetId”:“5a6a3fbfc211836b17f98f26-5a8c9651b6fce426e5615ee4”,“name”:“Green Lamp”,“features”:[{“featureId”:“5a6a3fbfc211836b17f98f26-44-3157328472+0”,“type”:“switch”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-45-3157328472+0”,“type”:“protection”,“writable”:true}]}],“product”:“LW320”,“device”:“socket”,“desc”:“Plug-In Socket”,“type”:“lwrfOneWay_v1”,“cat”:“Power”,“gen”:1},{“deviceId”:“5a6a3fbfc211836b17f98f26-14-3157328472+0”,“name”:“Out3”,“productCode”:“LW320”,“featureSets”:[{“featureSetId”:“5a6a3fbfc211836b17f98f26-5a8c99a8b6fce426e56237b9”,“name”:“Lava Lamp”,“features”:[{“featureId”:“5a6a3fbfc211836b17f98f26-46-3157328472+0”,“type”:“switch”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-47-3157328472+0”,“type”:“protection”,“writable”:true}]}],“product”:“LW320”,“device”:“socket”,“desc”:“Plug-In Socket”,“type”:“lwrfOneWay_v1”,“cat”:“Power”,“gen”:1},{“deviceId”:“5a6a3fbfc211836b17f98f26-23-3157328472+0”,“name”:“New001”,“productCode”:“LW320”,“featureSets”:[{“featureSetId”:“5a6a3fbfc211836b17f98f26-5ab405b39439d716e327c3ec”,“name”:“Outside Lights”,“features”:[{“featureId”:“5a6a3fbfc211836b17f98f26-42-3157328472+0”,“type”:“switch”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-43-3157328472+0”,“type”:“protection”,“writable”:true}]}],“product”:“LW320”,“device”:“socket”,“desc”:“Plug-In Socket”,“type”:“lwrfOneWay_v1”,“cat”:“Power”,“gen”:1},{“deviceId”:“5a6a3fbfc211836b17f98f26-24-3157328472+0”,“name”:“Twigs”,“productCode”:“LW320”,“featureSets”:[{“featureSetId”:“5a6a3fbfc211836b17f98f26-5ab407069439d716e32816eb”,“name”:“Twigs”,“features”:[{“featureId”:“5a6a3fbfc211836b17f98f26-48-3157328472+0”,“type”:“switch”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-49-3157328472+0”,“type”:“protection”,“writable”:true}]}],“product”:“LW320”,“device”:“socket”,“desc”:“Plug-In Socket”,“type”:“lwrfOneWay_v1”,“cat”:“Power”,“gen”:1},{“deviceId”:“5a6a3fbfc211836b17f98f26-25-3157328472+0”,“name”:“Window Lights”,“productCode”:“LW320”,“featureSets”:[{“featureSetId”:“5a6a3fbfc211836b17f98f26-5ab407849439d716e32836e5”,“name”:“Window Lights”,“features”:[{“featureId”:“5a6a3fbfc211836b17f98f26-50-3157328472+0”,“type”:“switch”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-51-3157328472+0”,“type”:“protection”,“writable”:true}]}],“product”:“LW320”,“device”:“socket”,“desc”:“Plug-In Socket”,“type”:“lwrfOneWay_v1”,“cat”:“Power”,“gen”:1},{“deviceId”:“5a6a3fbfc211836b17f98f26-26-3157328472+0”,“name”:“Hall Lights”,“productCode”:“L22”,“featureSets”:[{“featureSetId”:“5a6a3fbfc211836b17f98f26-5b2ea8c13f97f36a63dac7aa”,“name”:“Hall Lights”,“features”:[{“featureId”:“5a6a3fbfc211836b17f98f26-58-3157328472+0”,“type”:“switch”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-59-3157328472+0”,“type”:“dimLevel”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-60-3157328472+0”,“type”:“dimSetup”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-61-3157328472+0”,“type”:“protection”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-62-3157328472+0”,“type”:“power”,“writable”:false},{“featureId”:“5a6a3fbfc211836b17f98f26-63-3157328472+0”,“type”:“energy”,“writable”:false},{“featureId”:“5a6a3fbfc211836b17f98f26-52-3157328472+0”,“type”:“identify”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-53-3157328472+0”,“type”:“reset”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-54-3157328472+0”,“type”:“upgrade”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-55-3157328472+0”,“type”:“diagnostics”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-56-3157328472+0”,“type”:“periodOfBroadcast”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-57-3157328472+0”,“type”:“rgbColor”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-124-3157328472+0”,“type”:“bulbSetup”,“writable”:true}]},{“featureSetId”:“5a6a3fbfc211836b17f98f26-5b2ea8c13f97f36a63dac7ab”,“name”:“Landing Lights 2”,“features”:[{“featureId”:“5a6a3fbfc211836b17f98f26-64-3157328472+0”,“type”:“switch”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-65-3157328472+0”,“type”:“dimLevel”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-66-3157328472+0”,“type”:“dimSetup”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-67-3157328472+0”,“type”:“protection”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-68-3157328472+0”,“type”:“power”,“writable”:false},{“featureId”:“5a6a3fbfc211836b17f98f26-69-3157328472+0”,“type”:“energy”,“writable”:false},{“featureId”:“5a6a3fbfc211836b17f98f26-125-3157328472+0”,“type”:“bulbSetup”,“writable”:true}]}],“product”:“L22”,“device”:“dimmer”,“desc”:“Smart Dimmer”,“type”:“lwrfTwoWay_v2”,“cat”:“Lighting”,“gen”:2},{“deviceId”:“5a6a3fbfc211836b17f98f26-27-3157328472+0”,“name”:“Upstairs”,“productCode”:“L22”,“featureSets”:[{“featureSetId”:“5a6a3fbfc211836b17f98f26-5b2eaa333f97f36a63db2506”,“name”:“Landing Lights 1”,“features”:[{“featureId”:“5a6a3fbfc211836b17f98f26-76-3157328472+0”,“type”:“switch”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-77-3157328472+0”,“type”:“dimLevel”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-78-3157328472+0”,“type”:“dimSetup”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-79-3157328472+0”,“type”:“protection”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-80-3157328472+0”,“type”:“power”,“writable”:false},{“featureId”:“5a6a3fbfc211836b17f98f26-81-3157328472+0”,“type”:“energy”,“writable”:false},{“featureId”:“5a6a3fbfc211836b17f98f26-70-3157328472+0”,“type”:“identify”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-71-3157328472+0”,“type”:“reset”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-72-3157328472+0”,“type”:“upgrade”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-73-3157328472+0”,“type”:“diagnostics”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-74-3157328472+0”,“type”:“periodOfBroadcast”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-75-3157328472+0”,“type”:“rgbColor”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-122-3157328472+0”,“type”:“bulbSetup”,“writable”:true}]},{“featureSetId”:“5a6a3fbfc211836b17f98f26-5b2eaa333f97f36a63db2507”,“name”:“Bathroom Lights”,“features”:[{“featureId”:“5a6a3fbfc211836b17f98f26-82-3157328472+0”,“type”:“switch”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-83-3157328472+0”,“type”:“dimLevel”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-84-3157328472+0”,“type”:“dimSetup”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-85-3157328472+0”,“type”:“protection”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-86-3157328472+0”,“type”:“power”,“writable”:false},{“featureId”:“5a6a3fbfc211836b17f98f26-87-3157328472+0”,“type”:“energy”,“writable”:false},{“featureId”:“5a6a3fbfc211836b17f98f26-123-3157328472+0”,“type”:“bulbSetup”,“writable”:true}]}],“product”:“L22”,“device”:“dimmer”,“desc”:“Smart Dimmer”,“type”:“lwrfTwoWay_v2”,“cat”:“Lighting”,“gen”:2},{“deviceId”:“5a6a3fbfc211836b17f98f26-28-3157328472+0”,“name”:“Bedroom Light”,“productCode”:“L21”,“featureSets”:[{“featureSetId”:“5a6a3fbfc211836b17f98f26-5b59e7cd6955591b24a9d698”,“name”:“Bedroom Light”,“features”:[{“featureId”:“5a6a3fbfc211836b17f98f26-88-3157328472+0”,“type”:“identify”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-89-3157328472+0”,“type”:“reset”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-90-3157328472+0”,“type”:“upgrade”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-91-3157328472+0”,“type”:“diagnostics”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-92-3157328472+0”,“type”:“periodOfBroadcast”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-93-3157328472+0”,“type”:“rgbColor”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-94-3157328472+0”,“type”:“switch”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-95-3157328472+0”,“type”:“dimLevel”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-96-3157328472+0”,“type”:“dimSetup”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-97-3157328472+0”,“type”:“protection”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-98-3157328472+0”,“type”:“power”,“writable”:false},{“featureId”:“5a6a3fbfc211836b17f98f26-99-3157328472+0”,“type”:“energy”,“writable”:false},{“featureId”:“5a6a3fbfc211836b17f98f26-121-3157328472+0”,“type”:“bulbSetup”,“writable”:true}]}],“product”:“L21”,“device”:“dimmer”,“desc”:“Smart Dimmer”,“type”:“lwrfTwoWay_v2”,“cat”:“Lighting”,“gen”:2},{“deviceId”:“5a6a3fbfc211836b17f98f26-29-3157328472+0”,“name”:“Morning Room Light”,“productCode”:“L21”,“featureSets”:[{“featureSetId”:“5a6a3fbfc211836b17f98f26-5b5af1ec6955591b24e7a207”,“name”:“Morning Room Light”,“features”:[{“featureId”:“5a6a3fbfc211836b17f98f26-100-3157328472+0”,“type”:“identify”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-101-3157328472+0”,“type”:“reset”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-102-3157328472+0”,“type”:“upgrade”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-103-3157328472+0”,“type”:“diagnostics”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-104-3157328472+0”,“type”:“periodOfBroadcast”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-105-3157328472+0”,“type”:“rgbColor”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-106-3157328472+0”,“type”:“switch”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-107-3157328472+0”,“type”:“dimLevel”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-108-3157328472+0”,“type”:“dimSetup”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-109-3157328472+0”,“type”:“protection”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-110-3157328472+0”,“type”:“power”,“writable”:false},{“featureId”:“5a6a3fbfc211836b17f98f26-111-3157328472+0”,“type”:“energy”,“writable”:false},{“featureId”:“5a6a3fbfc211836b17f98f26-120-3157328472+0”,“type”:“bulbSetup”,“writable”:true}]}],“product”:“L21”,“device”:“dimmer”,“desc”:“Smart Dimmer”,“type”:“lwrfTwoWay_v2”,“cat”:“Lighting”,“gen”:2},{“deviceId”:“5a6a3fbfc211836b17f98f26-30-3157328472+0”,“name”:“Christmas Lights”,“productCode”:“LW320”,“featureSets”:[{“featureSetId”:“5a6a3fbfc211836b17f98f26-5c044a037d7db22a0a43152b”,“name”:“Reading Lamp”,“features”:[{“featureId”:“5a6a3fbfc211836b17f98f26-115-3157328472+0”,“type”:“switch”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-116-3157328472+0”,“type”:“protection”,“writable”:true}]}],“product”:“LW320”,“device”:“socket”,“desc”:“Plug-In Socket”,“type”:“lwrfOneWay_v1”,“cat”:“Power”,“gen”:1},{“deviceId”:“5a6a3fbfc211836b17f98f26-31-3157328472+0”,“name”:“Outdoor Lights”,“productCode”:“LW320”,“featureSets”:[{“featureSetId”:“5a6a3fbfc211836b17f98f26-5c044c037d7db22a0a442beb”,“name”:“Gracies Star”,“features”:[{“featureId”:“5a6a3fbfc211836b17f98f26-117-3157328472+0”,“type”:“switch”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-118-3157328472+0”,“type”:“protection”,“writable”:true}]}],“product”:“LW320”,“device”:“socket”,“desc”:“Plug-In Socket”,“type”:“lwrfOneWay_v1”,“cat”:“Power”,“gen”:1},{“deviceId”:“5a6a3fbfc211836b17f98f26-32-3157328472+0”,“name”:“Greenhouse Light”,“productCode”:“LW380”,“featureSets”:[{“featureSetId”:“5a6a3fbfc211836b17f98f26-5caa2c2a2d87a76677a91bea”,“name”:“Greenhouse Light”,“features”:[{“featureId”:“5a6a3fbfc211836b17f98f26-126-3157328472+0”,“type”:“switch”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-127-3157328472+0”,“type”:“protection”,“writable”:true}]}],“product”:“LW380”,“device”:“socket”,“desc”:“Plug-In Socket”,“type”:“lwrfOneWay_v1”,“cat”:“Power”,“gen”:1},{“deviceId”:“5a6a3fbfc211836b17f98f26-33-3157328472+0”,“name”:“Pump”,“productCode”:“LW380”,“featureSets”:[{“featureSetId”:“5a6a3fbfc211836b17f98f26-5caa2cb22d87a76677a91bf3”,“name”:“Pump”,“features”:[{“featureId”:“5a6a3fbfc211836b17f98f26-128-3157328472+0”,“type”:“switch”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-129-3157328472+0”,“type”:“protection”,“writable”:true}]}],“product”:“LW380”,“device”:“socket”,“desc”:“Plug-In Socket”,“type”:“lwrfOneWay_v1”,“cat”:“Power”,“gen”:1},{“deviceId”:“5a6a3fbfc211836b17f98f26-34-3157328472+0”,“name”:“Garden Lights”,“productCode”:“LW380”,“featureSets”:[{“featureSetId”:“5a6a3fbfc211836b17f98f26-5caa2d8f2d87a76677a91c13”,“name”:“Garden Lights”,“features”:[{“featureId”:“5a6a3fbfc211836b17f98f26-130-3157328472+0”,“type”:“switch”,“writable”:true},{“featureId”:“5a6a3fbfc211836b17f98f26-131-3157328472+0”,“type”:“protection”,“writable”:true}]}],“product”:“LW380”,“device”:“socket”,“desc”:"Plug-In Sock

100 16435 100 16435 0 0 41362 0 --:–:-- --:–:-- --:–:-- 41397

et",“type”:“lwrfOneWay_v1”,“cat”:“Power”,“gen”:1}]}

and then:

2019-05-09 20:36:49.203 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘Lightwave_Setup’: The name ‘LightwaveJSON’ cannot be resolved to an item or type; line 68, column 25, length 13

So there are a couple of problems here:

First, the extract

substringBetween(“{”,“Hub","gen":2}]}”)

isn’t returning anything because if you search through my deviceresults output the sequence Hub","gen:2}]}" never occurs, the structure’s different in my output:

Hub",“gen”:2},{“deviceId”:"5a6a3fb…

Because of that the LightWaveJSON string is undefined and it all goes downhill from there. Why mine should be different I don’t know.

Second problem is the extra numerical rubbish that curl introduces near the end of my deviceresults as well. We haven’t got that far yet, but if and when we do this will again break the data. I suspect this is happening because the output from my structure is longer than from yours so you’re only getting the one at the beginning. There’s a -s option for curl that might get rid of that.

Hope that helps a bit for your Friday contemplations. Let me know what else I can help with

Thats a great help
As i said i only have gen2 equipment so its good to see the gen1 stuff in there. I’ve changed the parts you posted so will not have these issues, trying to get it all compiled at present so hopefully some point today.

Right…
Before I go any further, I think this will now discover all your items correctly.
Don’t forget to enter username and password again.
Once you have tested ill get the rest of the code done.
Should just create 2 x items files (devices and authrules)
the one i’m concerned about is the devices, if this looks good we are on the final stretch

Lightwave_Setup_2019-05-10_1356.rules.txt (5.7 KB)

OK. I’m stuck at work at the moment but will try a quick test when I get home and report back. Any detailed work will have to be tomorrow though

No problem, i have faith :upside_down_face:

Gave it a quick try, I was worried because this is the only log output I got:

2019-05-10 17:58:07.608 [ome.event.ItemCommandEvent] - Item ‘Authentication_Switch’ received command OFF
2019-05-10 17:58:07.613 [vent.ItemStateChangedEvent] - Authentication_Switch changed from ON to OFF
2019-05-10 17:58:15.491 [INFO ] [eclipse.smarthome.model.script.Exec1] - rm: cannot remove ‘/etc/openhab2/rules/LightWave_Rules_Device_Refresh.rules’: No such file or directory
2019-05-10 17:58:15.546 [INFO ] [eclipse.smarthome.model.script.Exec2] - rm: cannot remove ‘/etc/openhab2/rules/LightWave_Rules_Device_Switch.rules’: No such file or directory
2019-05-10 17:58:15.600 [INFO ] [eclipse.smarthome.model.script.Exec3] - rm: cannot remove ‘/etc/openhab2/items/LightWave_Items_Devices.items’: No such file or directory
2019-05-10 17:58:15.666 [INFO ] [eclipse.smarthome.model.script.Exec4] -
2019-05-10 17:58:15.722 [INFO ] [eclipse.smarthome.model.script.Exec5] -
2019-05-10 17:58:15.778 [INFO ] [eclipse.smarthome.model.script.Exec6] -
2019-05-10 17:58:15.795 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘LightWave_Items_Authentication.items’
2019-05-10 17:58:15.834 [INFO ] [eclipse.smarthome.model.script.Exec8] -
2019-05-10 17:58:15.886 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘LightWave_Items_Devices.items’
2019-05-10 17:58:16.849 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘LightWave_Items_Authentication.items’
2019-05-10 17:58:17.265 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘LightWave_Items_Devices.items’

But, on checking, I’ve now got a LightWave_Items_Devices.items file which looks like it has items in it for pretty much all my stuff. I haven’t had a chance to play with those items yet and I won’t until Saturday morning but it’s looking hopeful

Great stuff
I’ve nearly finished the coding for all the rules to update the status’s and post updates back to lightwave. Hopefully a fully working solution by the end of the weekend.
And yeah I took a lot of the logging out once I got it working

FYI this is what it created:

String Lightwave_LinkPlus_currentTime
String Lightwave_LinkPlus_buttonPress
String Lightwave_LinkPlus_time
String Lightwave_LinkPlus_date
String Lightwave_LinkPlus_monthArray
String Lightwave_LinkPlus_weekdayArray
String Lightwave_LinkPlus_timeZone
String Lightwave_LinkPlus_locationLongitude
String Lightwave_LinkPlus_locationLatitude
String Lightwave_LinkPlus_duskTime
String Lightwave_LinkPlus_dawnTime
Number Lightwave_LinkPlus_rgbColor
String Lightwave_LinkPlus_day
String Lightwave_LinkPlus_month
String Lightwave_LinkPlus_year
String Lightwave_LinkPlus_weekday
Switch Lightwave_Internet_switch
String Lightwave_Internet_outletInUse
Switch Lightwave_Internet_protection
Number Lightwave_Internet_power
Number Lightwave_Internet_energy
Switch Lightwave_Internet_identify
Switch Lightwave_Internet_reset
Switch Lightwave_Internet_upgrade
Switch Lightwave_Internet_diagnostics
String Lightwave_Internet_periodOfBroadcast
Number Lightwave_Internet_rgbColor
Number Lightwave_Internet_voltage
Switch Lightwave_TVSocket_switch
String Lightwave_TVSocket_outletInUse
Switch Lightwave_TVSocket_protection
Number Lightwave_TVSocket_power
Number Lightwave_TVSocket_energy
Switch Lightwave_GreenLamp_switch
Switch Lightwave_GreenLamp_protection
Switch Lightwave_LavaLamp_switch
Switch Lightwave_LavaLamp_protection
Switch Lightwave_OutsideLights_switch
Switch Lightwave_OutsideLights_protection
Switch Lightwave_Twigs_switch
Switch Lightwave_Twigs_protection
Switch Lightwave_WindowLights_switch
Switch Lightwave_WindowLights_protection
Switch Lightwave_HallLights_switch
String Lightwave_HallLights_dimLevel
String Lightwave_HallLights_dimSetup
Switch Lightwave_HallLights_protection
Number Lightwave_HallLights_power
Number Lightwave_HallLights_energy
Switch Lightwave_HallLights_identify
Switch Lightwave_HallLights_reset
Switch Lightwave_HallLights_upgrade
Switch Lightwave_HallLights_diagnostics
String Lightwave_HallLights_periodOfBroadcast
Number Lightwave_HallLights_rgbColor
String Lightwave_HallLights_bulbSetup
Switch Lightwave_LandingLights2_switch
String Lightwave_LandingLights2_dimLevel
String Lightwave_LandingLights2_dimSetup
Switch Lightwave_LandingLights2_protection
Number Lightwave_LandingLights2_power
Number Lightwave_LandingLights2_energy
String Lightwave_LandingLights2_bulbSetup
Switch Lightwave_LandingLights1_switch
String Lightwave_LandingLights1_dimLevel
String Lightwave_LandingLights1_dimSetup
Switch Lightwave_LandingLights1_protection
Number Lightwave_LandingLights1_power
Number Lightwave_LandingLights1_energy
Switch Lightwave_LandingLights1_identify
Switch Lightwave_LandingLights1_reset
Switch Lightwave_LandingLights1_upgrade
Switch Lightwave_LandingLights1_diagnostics
String Lightwave_LandingLights1_periodOfBroadcast
Number Lightwave_LandingLights1_rgbColor
String Lightwave_LandingLights1_bulbSetup
Switch Lightwave_BathroomLights_switch
String Lightwave_BathroomLights_dimLevel
String Lightwave_BathroomLights_dimSetup
Switch Lightwave_BathroomLights_protection
Number Lightwave_BathroomLights_power
Number Lightwave_BathroomLights_energy
String Lightwave_BathroomLights_bulbSetup
Switch Lightwave_BedroomLight_identify
Switch Lightwave_BedroomLight_reset
Switch Lightwave_BedroomLight_upgrade
Switch Lightwave_BedroomLight_diagnostics
String Lightwave_BedroomLight_periodOfBroadcast
Number Lightwave_BedroomLight_rgbColor
Switch Lightwave_BedroomLight_switch
String Lightwave_BedroomLight_dimLevel
String Lightwave_BedroomLight_dimSetup
Switch Lightwave_BedroomLight_protection
Number Lightwave_BedroomLight_power
Number Lightwave_BedroomLight_energy
String Lightwave_BedroomLight_bulbSetup
Switch Lightwave_MorningRoomLight_identify
Switch Lightwave_MorningRoomLight_reset
Switch Lightwave_MorningRoomLight_upgrade
Switch Lightwave_MorningRoomLight_diagnostics
String Lightwave_MorningRoomLight_periodOfBroadcast
Number Lightwave_MorningRoomLight_rgbColor
Switch Lightwave_MorningRoomLight_switch
String Lightwave_MorningRoomLight_dimLevel
String Lightwave_MorningRoomLight_dimSetup
Switch Lightwave_MorningRoomLight_protection
Number Lightwave_MorningRoomLight_power
Number Lightwave_MorningRoomLight_energy
String Lightwave_MorningRoomLight_bulbSetup
Switch Lightwave_ReadingLamp_switch
Switch Lightwave_ReadingLamp_protection
Switch Lightwave_GraciesStar_switch
Switch Lightwave_GraciesStar_protection
Switch Lightwave_GreenhouseLight_switch
Switch Lightwave_GreenhouseLight_protection
Switch Lightwave_Pump_switch
Switch Lightwave_Pump_protection
Switch Lightwave_GardenLights_switch
Switch Lightwave_GardenLights_protection

try this, should have everything in there although not nicely formatted yet. be patient takes a while to load and you’ll get couple of script null errors towards the end where i haven’t ironed out all the bugs yet.
as always, don’t forget to put user/pass back in

Lightwave_Setup_2019-05-11_0912.rules.txt (21.9 KB)

Few things I have just noticed which are to fix,

  • parsed the energy and power as integers instead of decimals

  • Energy and power names missing suffixes

  • Dim parameters passed as wrong types (I think I haven’t got so going off yours)

This should fix the first 2, could you let me know any info you have for ,dim level, dim setup, bulb setup - dim level should be ok but need to see values, don’t know what the other types are… switches… arrays…
Havnt tested tho

Lightwave_Setup_2019-05-11_1141.rules.txt (22.0 KB)

I’ll try to test this evening. If not, Sunday for sure

1 Like

Looking positive.
It seems to be polling the LinkPlus every ten seconds or so and returning values for lots of things.

You asked for output to see how some of the values are being reported so here’s the log:

2019-05-12 21:28:21.734 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_currentTime changed from NULL to 1557692880
2019-05-12 21:28:21.742 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_currentTime changed from 1557692880 to 1557692882
2019-05-12 21:28:21.749 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_buttonPress changed from NULL to 0
2019-05-12 21:28:21.754 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_time changed from NULL to 77283
2019-05-12 21:28:21.775 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_date changed from NULL to 8271116
2019-05-12 21:28:21.780 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_monthArray changed from NULL to 0
2019-05-12 21:28:21.797 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_weekdayArray changed from NULL to 64
2019-05-12 21:28:21.801 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_timeZone changed from NULL to 3600
2019-05-12 21:28:21.807 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_time changed from 77283 to 77280
2019-05-12 21:28:21.809 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_locationLongitude changed from NULL to -2276021
2019-05-12 21:28:21.816 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_locationLatitude changed from NULL to 53549252
2019-05-12 21:28:21.819 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_duskTime changed from NULL to 75450
2019-05-12 21:28:21.825 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_dawnTime changed from NULL to 18805
2019-05-12 21:28:21.832 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_rgbColor changed from NULL to 768
2019-05-12 21:28:21.843 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_day changed from NULL to 12
2019-05-12 21:28:21.880 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_month changed from NULL to 5
2019-05-12 21:28:21.890 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_year changed from NULL to 2019
2019-05-12 21:28:21.901 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_weekday changed from NULL to 7
2019-05-12 21:28:21.917 [vent.ItemStateChangedEvent] - Lightwave_Internet_switch changed from NULL to ON
2019-05-12 21:28:21.928 [vent.ItemStateChangedEvent] - Lightwave_Internet_outletInUse changed from NULL to 1
2019-05-12 21:28:21.942 [vent.ItemStateChangedEvent] - Lightwave_Internet_protection changed from NULL to OFF
2019-05-12 21:28:21.954 [vent.ItemStateChangedEvent] - Lightwave_Internet_power changed from NULL to 30.0
2019-05-12 21:28:21.957 [vent.ItemStateChangedEvent] - Lightwave_Internet_Power_Cost changed from NULL to 0.0039
2019-05-12 21:28:22.047 [vent.ItemStateChangedEvent] - Lightwave_Internet_energy changed from NULL to 213.739
2019-05-12 21:28:22.067 [vent.ItemStateChangedEvent] - Lightwave_Internet_Energy_Cost changed from NULL to 27.78607
2019-05-12 21:28:22.071 [vent.ItemStateChangedEvent] - Lightwave_Internet_identify changed from NULL to OFF
2019-05-12 21:28:22.134 [vent.ItemStateChangedEvent] - Lightwave_Internet_reset changed from NULL to OFF
2019-05-12 21:28:22.146 [vent.ItemStateChangedEvent] - Lightwave_Internet_upgrade changed from NULL to OFF
2019-05-12 21:28:22.171 [vent.ItemStateChangedEvent] - Lightwave_Internet_diagnostics changed from NULL to 40
2019-05-12 21:28:22.191 [vent.ItemStateChangedEvent] - Lightwave_Internet_periodOfBroadcast changed from NULL to 16
2019-05-12 21:28:22.216 [vent.ItemStateChangedEvent] - Lightwave_Internet_rgbColor changed from NULL to 16711680
2019-05-12 21:28:22.230 [vent.ItemStateChangedEvent] - Lightwave_Internet_voltage changed from NULL to 2465
2019-05-12 21:28:22.270 [vent.ItemStateChangedEvent] - Lightwave_TVSocket_switch changed from NULL to OFF
2019-05-12 21:28:22.311 [vent.ItemStateChangedEvent] - Lightwave_TVSocket_outletInUse changed from NULL to 1
2019-05-12 21:28:22.346 [vent.ItemStateChangedEvent] - Lightwave_TVSocket_protection changed from NULL to OFF
2019-05-12 21:28:22.351 [vent.ItemStateChangedEvent] - Lightwave_TVSocket_power changed from NULL to 0.0
2019-05-12 21:28:22.366 [vent.ItemStateChangedEvent] - Lightwave_TVSocket_Power_Cost changed from NULL to 0.000
2019-05-12 21:28:22.370 [vent.ItemStateChangedEvent] - Lightwave_TVSocket_energy changed from NULL to 121.143
2019-05-12 21:28:22.381 [vent.ItemStateChangedEvent] - Lightwave_TVSocket_Energy_Cost changed from NULL to 15.74859
2019-05-12 21:28:22.386 [vent.ItemStateChangedEvent] - Lightwave_GreenLamp_switch changed from NULL to ON
2019-05-12 21:28:22.403 [vent.ItemStateChangedEvent] - Lightwave_GreenLamp_protection changed from NULL to OFF
2019-05-12 21:28:22.408 [vent.ItemStateChangedEvent] - Lightwave_LavaLamp_switch changed from NULL to ON
2019-05-12 21:28:22.423 [vent.ItemStateChangedEvent] - Lightwave_LavaLamp_protection changed from NULL to OFF
2019-05-12 21:28:22.455 [vent.ItemStateChangedEvent] - Lightwave_OutsideLights_switch changed from NULL to ON
2019-05-12 21:28:22.492 [vent.ItemStateChangedEvent] - Lightwave_OutsideLights_protection changed from NULL to OFF
2019-05-12 21:28:22.509 [vent.ItemStateChangedEvent] - Lightwave_Twigs_switch changed from NULL to ON
2019-05-12 21:28:22.531 [vent.ItemStateChangedEvent] - Lightwave_Twigs_protection changed from NULL to OFF
2019-05-12 21:28:22.552 [vent.ItemStateChangedEvent] - Lightwave_WindowLights_switch changed from NULL to ON
2019-05-12 21:28:22.557 [vent.ItemStateChangedEvent] - Lightwave_WindowLights_protection changed from NULL to OFF
2019-05-12 21:28:22.568 [vent.ItemStateChangedEvent] - Lightwave_HallLights_switch changed from NULL to ON
2019-05-12 21:28:22.573 [vent.ItemStateChangedEvent] - Lightwave_HallLights_dimLevel changed from NULL to 100
2019-05-12 21:28:22.598 [vent.ItemStateChangedEvent] - Lightwave_HallLights_dimSetup changed from NULL to 108183552
2019-05-12 21:28:22.618 [vent.ItemStateChangedEvent] - Lightwave_HallLights_protection changed from NULL to OFF
2019-05-12 21:28:22.631 [vent.ItemStateChangedEvent] - Lightwave_HallLights_power changed from NULL to 0.0
2019-05-12 21:28:22.652 [vent.ItemStateChangedEvent] - Lightwave_HallLights_Power_Cost changed from NULL to 0.000
2019-05-12 21:28:22.687 [vent.ItemStateChangedEvent] - Lightwave_HallLights_energy changed from NULL to 3.341
2019-05-12 21:28:22.698 [vent.ItemStateChangedEvent] - Lightwave_HallLights_Energy_Cost changed from NULL to 0.43433
2019-05-12 21:28:22.733 [vent.ItemStateChangedEvent] - Lightwave_HallLights_identify changed from NULL to OFF
2019-05-12 21:28:22.750 [vent.ItemStateChangedEvent] - Lightwave_HallLights_reset changed from NULL to OFF
2019-05-12 21:28:22.776 [vent.ItemStateChangedEvent] - Lightwave_HallLights_upgrade changed from NULL to OFF
2019-05-12 21:28:22.818 [vent.ItemStateChangedEvent] - Lightwave_HallLights_diagnostics changed from NULL to 31
2019-05-12 21:28:22.835 [vent.ItemStateChangedEvent] - Lightwave_HallLights_periodOfBroadcast changed from NULL to 16
2019-05-12 21:28:22.843 [vent.ItemStateChangedEvent] - Lightwave_HallLights_rgbColor changed from NULL to 1
2019-05-12 21:28:22.865 [vent.ItemStateChangedEvent] - Lightwave_HallLights_bulbSetup changed from NULL to 10486272
2019-05-12 21:28:22.898 [vent.ItemStateChangedEvent] - Lightwave_LandingLights2_switch changed from NULL to ON
2019-05-12 21:28:22.920 [vent.ItemStateChangedEvent] - Lightwave_LandingLights2_dimLevel changed from NULL to 100
2019-05-12 21:28:22.938 [vent.ItemStateChangedEvent] - Lightwave_LandingLights2_dimSetup changed from NULL to 635174912
2019-05-12 21:28:22.955 [vent.ItemStateChangedEvent] - Lightwave_LandingLights2_protection changed from NULL to OFF
2019-05-12 21:28:22.969 [vent.ItemStateChangedEvent] - Lightwave_LandingLights2_power changed from NULL to 0.0
2019-05-12 21:28:22.999 [vent.ItemStateChangedEvent] - Lightwave_LandingLights2_Power_Cost changed from NULL to 0.000
2019-05-12 21:28:23.026 [vent.ItemStateChangedEvent] - Lightwave_LandingLights2_energy changed from NULL to 0.0
2019-05-12 21:28:23.029 [vent.ItemStateChangedEvent] - Lightwave_LandingLights2_Energy_Cost changed from NULL to 0.000
2019-05-12 21:28:23.032 [vent.ItemStateChangedEvent] - Lightwave_LandingLights2_bulbSetup changed from NULL to 10486272
2019-05-12 21:28:23.042 [vent.ItemStateChangedEvent] - Lightwave_LandingLights1_switch changed from NULL to ON
2019-05-12 21:28:23.084 [vent.ItemStateChangedEvent] - Lightwave_LandingLights1_dimLevel changed from NULL to 100
2019-05-12 21:28:23.091 [vent.ItemStateChangedEvent] - Lightwave_LandingLights1_dimSetup changed from NULL to 110510080
2019-05-12 21:28:23.097 [vent.ItemStateChangedEvent] - Lightwave_LandingLights1_protection changed from NULL to OFF
2019-05-12 21:28:23.143 [vent.ItemStateChangedEvent] - Lightwave_LandingLights1_power changed from NULL to 28.0
2019-05-12 21:28:23.152 [vent.ItemStateChangedEvent] - Lightwave_LandingLights1_Power_Cost changed from NULL to 0.00364
2019-05-12 21:28:23.164 [vent.ItemStateChangedEvent] - Lightwave_LandingLights1_energy changed from NULL to 1.694
2019-05-12 21:28:23.174 [vent.ItemStateChangedEvent] - Lightwave_LandingLights1_Energy_Cost changed from NULL to 0.22022
2019-05-12 21:28:23.178 [vent.ItemStateChangedEvent] - Lightwave_LandingLights1_identify changed from NULL to OFF
2019-05-12 21:28:23.184 [vent.ItemStateChangedEvent] - Lightwave_LandingLights1_reset changed from NULL to OFF
2019-05-12 21:28:23.188 [vent.ItemStateChangedEvent] - Lightwave_LandingLights1_upgrade changed from NULL to OFF
2019-05-12 21:28:23.236 [vent.ItemStateChangedEvent] - Lightwave_LandingLights1_diagnostics changed from NULL to 29
2019-05-12 21:28:23.251 [vent.ItemStateChangedEvent] - Lightwave_LandingLights1_periodOfBroadcast changed from NULL to 16
2019-05-12 21:28:23.268 [vent.ItemStateChangedEvent] - Lightwave_LandingLights1_rgbColor changed from NULL to 1
2019-05-12 21:28:23.318 [vent.ItemStateChangedEvent] - Lightwave_LandingLights1_bulbSetup changed from NULL to 10486272
2019-05-12 21:28:23.329 [vent.ItemStateChangedEvent] - Lightwave_BathroomLights_switch changed from NULL to OFF
2019-05-12 21:28:23.336 [vent.ItemStateChangedEvent] - Lightwave_BathroomLights_dimLevel changed from NULL to 100
2019-05-12 21:28:23.345 [vent.ItemStateChangedEvent] - Lightwave_BathroomLights_dimSetup changed from NULL to 139264000
2019-05-12 21:28:23.361 [vent.ItemStateChangedEvent] - Lightwave_BathroomLights_protection changed from NULL to OFF
2019-05-12 21:28:23.369 [vent.ItemStateChangedEvent] - Lightwave_BathroomLights_power changed from NULL to 0.0
2019-05-12 21:28:23.380 [vent.ItemStateChangedEvent] - Lightwave_BathroomLights_Power_Cost changed from NULL to 0.000
2019-05-12 21:28:23.383 [vent.ItemStateChangedEvent] - Lightwave_BathroomLights_energy changed from NULL to 0.988
2019-05-12 21:28:23.387 [vent.ItemStateChangedEvent] - Lightwave_BathroomLights_Energy_Cost changed from NULL to 0.12844
2019-05-12 21:28:23.389 [vent.ItemStateChangedEvent] - Lightwave_BathroomLights_bulbSetup changed from NULL to 10486272
2019-05-12 21:28:23.391 [vent.ItemStateChangedEvent] - Lightwave_BedroomLight_identify changed from NULL to OFF
2019-05-12 21:28:23.394 [vent.ItemStateChangedEvent] - Lightwave_BedroomLight_reset changed from NULL to OFF
2019-05-12 21:28:23.397 [vent.ItemStateChangedEvent] - Lightwave_BedroomLight_upgrade changed from NULL to OFF
2019-05-12 21:28:23.399 [vent.ItemStateChangedEvent] - Lightwave_BedroomLight_diagnostics changed from NULL to 30
2019-05-12 21:28:23.401 [vent.ItemStateChangedEvent] - Lightwave_BedroomLight_periodOfBroadcast changed from NULL to 16
2019-05-12 21:28:23.404 [vent.ItemStateChangedEvent] - Lightwave_BedroomLight_rgbColor changed from NULL to 1
2019-05-12 21:28:23.406 [vent.ItemStateChangedEvent] - Lightwave_BedroomLight_switch changed from NULL to OFF
2019-05-12 21:28:23.409 [vent.ItemStateChangedEvent] - Lightwave_BedroomLight_dimLevel changed from NULL to 100
2019-05-12 21:28:23.411 [vent.ItemStateChangedEvent] - Lightwave_BedroomLight_dimSetup changed from NULL to 150732800
2019-05-12 21:28:23.414 [vent.ItemStateChangedEvent] - Lightwave_BedroomLight_protection changed from NULL to OFF
2019-05-12 21:28:23.417 [vent.ItemStateChangedEvent] - Lightwave_BedroomLight_power changed from NULL to 0.0
2019-05-12 21:28:23.419 [vent.ItemStateChangedEvent] - Lightwave_BedroomLight_Power_Cost changed from NULL to 0.000
2019-05-12 21:28:23.421 [vent.ItemStateChangedEvent] - Lightwave_BedroomLight_energy changed from NULL to 1.133
2019-05-12 21:28:23.424 [vent.ItemStateChangedEvent] - Lightwave_BedroomLight_Energy_Cost changed from NULL to 0.14729
2019-05-12 21:28:23.426 [vent.ItemStateChangedEvent] - Lightwave_BedroomLight_bulbSetup changed from NULL to 10486272
2019-05-12 21:28:23.429 [vent.ItemStateChangedEvent] - Lightwave_MorningRoomLight_identify changed from NULL to OFF
2019-05-12 21:28:23.431 [vent.ItemStateChangedEvent] - Lightwave_MorningRoomLight_reset changed from NULL to OFF
2019-05-12 21:28:23.434 [vent.ItemStateChangedEvent] - Lightwave_MorningRoomLight_upgrade changed from NULL to OFF
2019-05-12 21:28:23.436 [vent.ItemStateChangedEvent] - Lightwave_MorningRoomLight_diagnostics changed from NULL to 28
2019-05-12 21:28:23.438 [vent.ItemStateChangedEvent] - Lightwave_MorningRoomLight_periodOfBroadcast changed from NULL to 16
2019-05-12 21:28:23.440 [vent.ItemStateChangedEvent] - Lightwave_MorningRoomLight_rgbColor changed from NULL to 1
2019-05-12 21:28:23.443 [vent.ItemStateChangedEvent] - Lightwave_MorningRoomLight_switch changed from NULL to OFF
2019-05-12 21:28:23.445 [vent.ItemStateChangedEvent] - Lightwave_MorningRoomLight_dimLevel changed from NULL to 100
2019-05-12 21:28:23.447 [vent.ItemStateChangedEvent] - Lightwave_MorningRoomLight_dimSetup changed from NULL to 123731968
2019-05-12 21:28:23.450 [vent.ItemStateChangedEvent] - Lightwave_MorningRoomLight_protection changed from NULL to OFF
2019-05-12 21:28:23.453 [vent.ItemStateChangedEvent] - Lightwave_MorningRoomLight_power changed from NULL to 0.0
2019-05-12 21:28:23.455 [vent.ItemStateChangedEvent] - Lightwave_MorningRoomLight_Power_Cost changed from NULL to 0.000
2019-05-12 21:28:23.458 [vent.ItemStateChangedEvent] - Lightwave_MorningRoomLight_energy changed from NULL to 0.246
2019-05-12 21:28:23.460 [vent.ItemStateChangedEvent] - Lightwave_MorningRoomLight_Energy_Cost changed from NULL to 0.03198
2019-05-12 21:28:23.463 [vent.ItemStateChangedEvent] - Lightwave_MorningRoomLight_bulbSetup changed from NULL to 10486272
2019-05-12 21:28:23.465 [vent.ItemStateChangedEvent] - Lightwave_ReadingLamp_switch changed from NULL to ON
2019-05-12 21:28:23.467 [vent.ItemStateChangedEvent] - Lightwave_ReadingLamp_protection changed from NULL to OFF
2019-05-12 21:28:23.470 [vent.ItemStateChangedEvent] - Lightwave_GraciesStar_switch changed from NULL to OFF
2019-05-12 21:28:23.472 [vent.ItemStateChangedEvent] - Lightwave_GraciesStar_protection changed from NULL to OFF
2019-05-12 21:28:23.475 [vent.ItemStateChangedEvent] - Lightwave_GreenhouseLight_switch changed from NULL to OFF
2019-05-12 21:28:23.478 [vent.ItemStateChangedEvent] - Lightwave_GreenhouseLight_protection changed from NULL to OFF
2019-05-12 21:28:23.480 [vent.ItemStateChangedEvent] - Lightwave_Pump_switch changed from NULL to ON
2019-05-12 21:28:23.483 [vent.ItemStateChangedEvent] - Lightwave_Pump_protection changed from NULL to OFF
2019-05-12 21:28:23.485 [vent.ItemStateChangedEvent] - Lightwave_GardenLights_switch changed from NULL to ON
2019-05-12 21:28:23.488 [vent.ItemStateChangedEvent] - Lightwave_GardenLights_protection changed from NULL to OFF
2019-05-12 21:28:25.232 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘LightWave_Rules_Device_Refresh.rules’
2019-05-12 21:28:27.236 [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule ‘LightWave Structure’: An error occurred during the script execution: null
2019-05-12 21:28:31.305 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_currentTime changed from 1557692882 to 1557692906
2019-05-12 21:28:31.333 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_time changed from 77280 to 77306
2019-05-12 21:29:04.626 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘LightWave_Rules_Device_Switch.rules’
2019-05-12 21:29:08.772 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_currentTime changed from 1557692906 to 1557692944
2019-05-12 21:29:08.792 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_time changed from 77306 to 77344
2019-05-12 21:29:09.125 [vent.ItemStateChangedEvent] - Lightwave_LandingLights1_energy changed from 1.694 to 1.695
2019-05-12 21:29:09.129 [vent.ItemStateChangedEvent] - Lightwave_LandingLights1_Energy_Cost changed from 0.22022 to 0.22035
2019-05-12 21:29:12.744 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_currentTime changed from 1557692944 to 1557692948
2019-05-12 21:29:12.766 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_time changed from 77344 to 77348
2019-05-12 21:29:16.760 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_currentTime changed from 1557692948 to 1557692952
2019-05-12 21:29:16.774 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_time changed from 77348 to 77352
2019-05-12 21:29:21.622 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_currentTime changed from 1557692952 to 1557692956
2019-05-12 21:29:21.633 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_time changed from 77352 to 77356
2019-05-12 21:29:25.608 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_currentTime changed from 1557692956 to 1557692961
2019-05-12 21:29:25.624 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_time changed from 77356 to 77361
2019-05-12 21:29:25.863 [vent.ItemStateChangedEvent] - Lightwave_HallLights_energy changed from 3.341 to 3.342
2019-05-12 21:29:25.870 [vent.ItemStateChangedEvent] - Lightwave_HallLights_Energy_Cost changed from 0.43433 to 0.43446
2019-05-12 21:29:34.312 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_currentTime changed from 1557692961 to 1557692969
2019-05-12 21:29:34.330 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_time changed from 77361 to 77369
2019-05-12 21:29:44.258 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_currentTime changed from 1557692969 to 1557692979
2019-05-12 21:29:44.268 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_time changed from 77369 to 77379
2019-05-12 21:29:54.440 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_currentTime changed from 1557692979 to 1557692989
2019-05-12 21:29:54.462 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_time changed from 77379 to 77389
2019-05-12 21:30:05.197 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_currentTime changed from 1557692989 to 1557692999
2019-05-12 21:30:05.211 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_time changed from 77389 to 77400
2019-05-12 21:30:14.361 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_currentTime changed from 1557692999 to 1557693009
2019-05-12 21:30:14.377 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_time changed from 77400 to 77409
2019-05-12 21:30:24.292 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_currentTime changed from 1557693009 to 1557693019
2019-05-12 21:30:24.305 [vent.ItemStateChangedEvent] - Lightwave_LinkPlus_time changed from 77409 to 77419

I’ll let it run for now and see how it holds up

1 Like

Good stuff. Glad it’s working. There’s a few bits I’ll change slightly. Main thing I need to know is the bits I put above. But for now you have a working solution. Mines been solid for 48 hrs now.
Be a little patient if you switch something on/off. If it’s between polls then you may see it change back state for 10 seconds but it will rectify itself on the next poll.
Add the bits (switches) in habpanel etc and have a test. Should all respond ok, just watch the reset switch (don’t want you to have to set it all up again).
You can set your electricity cost in the rule file created - currently set at 13p per kWh
You can also play with the refresh timing, in the refresh rule just amend the 0/10, which is 10 seconds to whatever interval, didn’t wanna push it too hard to start with

I’ll try to do some research tomorrow evening and get that info for you

Okay got some info on dimlevel etc.

Dimlevel seems to be an integer between 0 and 100, corresponding to the dimmer percentage (as set by Alexa etc when you say ‘dim the light to 50 percent’).

Dimsetup and Bulbsetup are a bit more of a mystery. I have a single-gang Gen 2 dimmer in the Morning Room controlling a single 6W LED bayonet GLS style bulb. Dimsetup returns 123731968 and BulbSetup is 10486272. What those mean in practice, anyone’s guess. I think they are what gets defined when you change the calibration settings for the dimmer in the LWRF app.

For one of my sockets I also pulled up Voltage = 2438 so a divide by 10 needed there, however Power=30 (watts) so no division needed, and Energy=214.482 which by cross-checking with the app is the cumulative energy in KwH since the last measurement reset, again no division needed.

A few more observations:

When I look in the .items file everything’s been put into the GroundSockets group or one of it’s derivitives - including all my dimmers! So perhaps we need to check the device type when it enumerates them and assign the group based on that.

Also it’s lovingly created items for power consumption etc for each of my my Gen 1 items. I’m sure this is because the API has ‘placeholders’ for all the possible values regardless of the generation (easier for the API developers) but all of those will always return zero or undefined because Gen 1 doesn’t support two-way comms or power consumption. I’m only mentioning this because we now have a number of OpenHAB items for all of these that willl never be of any actual use.

On a similar tack, I wonder if we’re over-complicating by trying to deal with stuff like BulbSetup and LinkPlusTime etc. While cool to know, these don’t have much real-world use when what we really want to be polling for is the on/off status, dim level etc and the power for Gen 2 devices. Not trying to criticise the comprehensive and hard work you’re putting in here, just wondering aloud if a more pared-back approach might reduce the load on the Pi and the amount of logging activity (For example, I’m logging two entries for the latest time off the LinkPlus every ten seconds, day and night).

However, all that aside, it works and it works pretty well. Well done - major achievement. Where would you like to take it from here?

EDIT:
What I’ll do tomorrow is pull a complete set of the values returned for each type of device that I have so you can correlate them with the structure. Hopefully that’ll give you something more solid to work with than my late-night ramblings.

Cheers for the feedback.
Does the dimming work btw as I have only switches?

  • I’m aware of the voltage division needed.

  • I wanted to add everything as it’s only on that initial discovery we can add stuff easily, people can then choose to remove the items they don’t want like the link plus time etc from the generated files (and put them somewhere safe in case they want to add back

  • The groups were a work in progress but I got sidetracked making the discovery better, I’ll work on these more in the coming weeks, everything is in that group as that’s the only thing I have :smile:

  • I’ll have a look to see if I can easily identify gen1/gen2 and remove the unneeded placeholders

On another note (I won’t post up until I’ve made progress with the above also since we are working):

  • I’ve modified the refresh rule slightly to lighten the load on the system and I’ve got the execution time of the rule down to 3 seconds on my rpi model 3

  • I’m also working on the most annoying thing for me… turning a switch off/on but then the switch changing back state for a few seconds while the rules catch up

I’m glad we have a working solution for now though, even though it’s not a fully fledged binding and is far from perfect.
As long as it’s appreciated and at least one person gets use from it I’ll continue to try and improve it, although probably at a slower pace as I’ve put a lot of time into it and I’m tired and need some sleep :rofl:

I’ve emailed tech support for some info on bulb setup etc.
Also, the time/long/lat etc can also be used for geofencing in openhab if required by some, products may not necessarily be on the same site as the openhab install but connected by site to site vpn like I have some devices at my office, therefore the openhab long/lat wouldn’t work in this situation so may be useful.
I’ll also convert the two dates into human readable(currently seconds from 00:00 and the other is a datetime value).

Now I’ve got my head around the system and also learnt a little more about openhab from this I’ll have a look at modifying the existing lightwave binding to add all this. At least I’ll have some basic foundation then to learn the backend side of things. Just wish I had a little more skill set in this area instead of being self taught.

One last thing… the gen1’s that it created power/energy for… can you look in the items file and see if it’s just the cost and not the actual kWh/w. The costs are not part of the api, I generated them myself which is why there is also an electricity cost variable (much the same as the app does), I think I may have created then for everything that has a switch type though, can’t remember off hand

Can you also check, in your items file I added a suffix to the item name to specify if it’s readonly, can you look at the bulbsetup/dimsetup to see if these are readonly