LightwaveRF Binding Updated

Hi Guys,

The link below is for an updated build of the Lightwaverf binding. When lightwaverf changed their protocols a lot of the original messages stopped working. This was built about 9 months ago and as such the Energy Monitor seems to no longer work.

However, I use it all the time for light switches and power.

please try it out. At some point i will try and get the energy monitor working again, and create a pull request to get it back into the main codebase.

hopefully you find it helpful

what gen 2??

ah no sorry - this is an old WifiLink, before they released the 2nd gen kit.

Thanks for clarifying i was about to screw :laughing:

So does the Gen 2 wifi link not support the gen 1 ?

The gen 2 hub supports gen 1 switches etc but the api is different and it operates at 800 and something MHz and has not been hacked to my knowledge and probably won’t be as it’s homekit

i did see in the news (i’ll see if i can find the link) yesterday that they have just released the REST api, which would make things a lot easier. But i assume would route every request back to their infra before coming back to the local kit.

I’m no dev but I’m close to getting gen 2 working with pure rules/items.

I need a valid way to poll multiple urls though with variables not using cron timers as it’s crashing it.
Http and exec bindings won’t work as need variables in the urls although I have just had a brainwave :joy:

The problem with the api is there doesn’t seem to be a way to get ALL device/feature status’s with one request

Think I’ve sorted the issue. Will post up after footy training in couple hours

Didn’t quite work.

It’s created:

Lightwave_Items_Authentication.items
Lightwave_Rules_Authentication.rules
Lightwave_Rules_Structures.rules

But nothing else

In the file Lightwave_Setup.rules at this point:

//Get Items And Features
var String access = Access_Token.state.toString
val deviceresults =
executeCommandLine(“curl@@-g@@-XGET@@https://publicapi.lightwaverf.com/v1/Structure/” + Structure.state.toString + "@@-H@@Authorization:bearer " + access,5000)

my editor is red-lining Access_Token and Structure as undefined. They
aren’t defined elsewhere in that file, but they do exist as items in
the .items files and I’ve displayed them on my sitemap to check they
definitely contain values, which they do.

I’m also seeing this in the event log:

2019-05-02 21:06:31.202 [INFO ] [clipse.smarthome.model.script.Exec13] -
2019-05-02 21:06:37.328 [INFO ] [clipse.smarthome.model.script.Exec14] -
2019-05-02 21:06:37.483 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘LightWave_Rules_Structures.rules’
2019-05-02 21:06:37.952 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘Lightwave_Setup’: For input string: “{nullHub”,“gen”:2}]}"
2019-05-02 21:06:38.842 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘LightWave_Rules_Structures.rules’
2019-05-02 21:06:47.794 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘Lightwave_Setup’: For input string: “{nullHub”,“gen”:2}]}"

Since Exec13 and Exec14 come right before the //Get Items And Features
section, which would generate the missing extra files, I’m guessing
the problem is indeed that those two variables aren’t defined.

Any thoughts?

Hi, In other systems with an api that has access tokens and things passed to it
I have passed the access token and parameters directly in the command line .sh

eg

/usr/bin/curl -s -X GET 'https://api.openuv.io/api/v1/uv?lat=54.93&lng=-1.98' -H 'x-access-token:e3824e3693a7657848976498764974c216d803' > /home/chod/openhab2/html/openuv.txt

then I read the returned JSON with

String Openuv_UVIndexMax "UV Index (max): [%s]" <uvsun>  http="<[http://127.0.0.1:8080/static/openuv.txt:60000:JSONPATH($.result.uv_max)]" }

rather than pass from an Item, which I’m not sure how you would, which I will look into

Further update:

I don’t think it’s anything to do with those two values being undefined.
I added a line to the rule to log what comes back as deviceresults and this is what it gets:

2019-05-02 21:40:05.384 [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 40971 0 --:–:-- --:–:-- --:–:-- 41087

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

Then the next line in the log is the error we’ve seen before, coming
from the next line in the rule:

2019-05-02 21:40:05.395 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘Lightwave_Setup’: For input string: “{nullHub”,“gen”:2}]}"

So is the issue here might be the numerical data report lines that
curl seems to be adding in, particularly at the end where it breaks up
the data?
Is there a command line option for curl to get rid of those?

Here you go, sorry for the delay work commitments slowed me down:
1: Download the two files and put in the respective folders and remove the .txt extension
2 :Ensure openhab has write permissions on items and rules folders (these are hard coded as etc/openhab2/* so if you need to change you need to edit the rules file and replace all occurrences with your path)
3: In rules file add username and password in the variables at the top of the file.
4: Add the switch switch created in the items file to habpanel or another ui
5: Hit the switch and wait for the magic (monitor the log for errors as the major steps are logged)
6: If it doesn’t work you can make your changes and hit the switch again as the rule automatically deletes old files.

I only have 1 gen2 hub and multiple gen2 sockets on my setup so hopefully it will work for others. it will create the necessary files for you to play about though. I have only implemented switches/power and energy at present but if you look at the api and my files you.ll be able to work it out.
switch - self explanatory
Energy - power consumption (total) in W/hrs - divide by 1000 to get kW/h
Power - current consumption in watts
the devices poll every ten seconds at present but you can change on cron timings.

its not perfect and is consuming alot of threads but i just wanted to get a working solution first, ill be working on it over the coming months, unless someone wants to take it and create a binding (i dont have the knowledge YET)
Feedback welcome.LightWave_Setup.items.txt (28 Bytes)

Lightwave_Setup.rules.txt (10.0 KB)

** UPDATE** Use this rules file instead:

1 Like

just uploaded reworked files, delete existing files, put username and password back in rules file and fire the rule either with the item file switch or however.
yes the report return values are the biggest pain, i havn’t been able to get the http binding to accept the headers though in rules. i’m going to look at appending the http.cfg file with the bits needed, wont be easy to automate for others to setup though as if it errors out then wont be able to just delete their cfg file in fear of other items in there.

the biggest problem with the old files was the crons not firing. ive taken a different route now. run it but if it erros out, this time instead of doing the device results log, do the JSON that follows it, this should have removed the log header and be a full json string.

just re uploaded the rule file, small mistake in it, a stray + sign.

Ill have a look at your log tomorrow, bed time, knackered.
post up a new one from this new rule file if you can. at least i can now see other item types aswell to see their properties.

screenshot whilst boiling the kettle, its working so sense of achievement this end for something i feared i was never going to get implemented, even if it is a bodge route for now

could you do a get request through postman for /structures ( take out your personal details) and post it to me so i can look at the differences between yours and mine, it may be my substring commands dont work on your setup, so would like to find a better way.

looking at your logs you put up though i dont think it authenticated and got the structure in time, the new rule should fix that.

this is why i changed the way i did it as i was getting the same

this is also the reason it didnt generate the items files for the actual devices, should be like 5 files in total (3 rule 2 items), it couldnt discover the devices as it failed at the structure.

Could you please post the and solution to this when you find it? The xiaomi binding is crashing quartz / cron for me. Want to see if I can change it to not.

Thanks

Solution was to do away with cron timers :smile:
Have you got a lot of rules with timers in?
If so, depending on the rule there are other options

So you had timers in rules or in binging?