LightwaveRF Binding Updated

Initial tests look ok, I still have issues with Auth occasionally, I don’t know if it’s where I’m setting up again from scratch, but there’s something it just doesn’t like.

you’ll get loads of errors if its already in the system running when you press setup or update.
once its done though the errors shouldn’t reoccur. (other than Api limit reached if your going too quick for lightwaves ridiculously low limit)

I was still seeing

5:31:08.630 [INFO ] [smarthome.event.ItemStateChangedEvent] - LwGet_Run changed from ON to OFF
15:31:14.621 [ERROR] [nhab.binding.exec.handler.ExecHandler] - An exception occurred while formatting the command line with the current time and input values : ‘Format specifier ‘%2$s’’
15:31:14.624 [INFO ] [smarthome.event.ItemStateChangedEvent] - LwGet_Run changed from OFF to ON
15:31:14.634 [INFO ] [smarthome.event.ItemStateChangedEvent] - LwGet_Run changed from ON to OFF
15:31:20.626 [ERROR] [nhab.binding.exec.handler.ExecHandler] - An exception occurred while formatting the command line with the current time and input values : ‘Format specifier ‘%2$s’’
15:31:20.632 [INFO ] [smarthome.event.ItemStateChangedEvent] - LwGet_Run changed from OFF to ON
15:31:20.633 [INFO ] [smarthome.event.ItemStateChangedEvent] - LwGet_Run changed from ON to OFF
15:31:26.629 [ERROR] [nhab.binding.exec.handler.ExecHandler] - An exception occurred while formatting the command line with the current time and input values : ‘Format specifier ‘%2$s’’
15:31:26.640 [INFO ] [smarthome.event.ItemStateChangedEvent] - LwGet_Run changed from OFF to ON
15:31:26.651 [INFO ] [smarthome.event.ItemStateChangedEvent] - LwGet_Run changed from ON to OFF
15:31:32.632 [ERROR] [nhab.binding.exec.handler.ExecHandler] - An exception occurred while formatting the command line with the current time and input values : ‘Format specifier ‘%2$s’’
15:31:32.660 [INFO ] [smarthome.event.ItemStateChangedEvent] - LwGet_Run changed from OFF to ON
15:31:32.663 [INFO ] [smarthome.event.ItemStateChangedEvent] - LwGet_Run changed from ON to OFF
15:31:38.636 [ERROR] [nhab.binding.exec.handler.ExecHandler] - An exception occurred while formatting the command line with the current time and input values : ‘Format specifier ‘%2$s’’
15:31:38.682 [INFO ] [smarthome.event.ItemStateChangedEvent] - LwGet_Run changed from OFF to ON
15:31:38.686 [INFO ] [smarthome.event.ItemStateChangedEvent] - LwGet_Run changed from ON to OFF
15:31:44.638 [ERROR] [nhab.binding.exec.handler.ExecHandler] - An exception occurred while formatting the command line with the current time and input values : ‘Format specifier ‘%2$s’’
15:31:44.643 [INFO ] [smarthome.event.ItemStateChangedEvent] - LwGet_Run changed from OFF to ON
15:31:44.645 [INFO ] [smarthome.event.ItemStateChangedEvent] - LwGet_Run changed from ON to OFF
15:31:50.641 [ERROR] [nhab.binding.exec.handler.ExecHandler] - An exception occurred while formatting the command line with the current time and in

In the logs, which I believe is because the token isn’t getting correctly passed to the Lw_Get script, even though the refresh and access tokens seem to get updated. If I replace it with my code that doesn’t check LwAuth_Inp.state matches Authentication, but just sets it again and switches on it, the issue resolves.

However, the same code you put in there earlier today did work, so there is something intermittent somewhere!

Also, I need to hit it some more, but I don’t think there is a limit in terms of how many times a minute you can hit it, or how many features you can request, however, I think their API has a run timeout on it, and if the request takes longer than x seconds it just kills it and returns structure not found.

It defo has a limit to how much you can hit it as when im testing in postman it gives me the dreaded {structure not found}, and im sure when i made v1 and I was querying each feature individually i told me to F-off (100 features every 5 seconds it did not like at all), then i found the batch read.
We will find out soon as I am now all set up IDE wise and have just started writing the binding (will start by querying each feature individually to see if i get told to get lost by LW’s servers)

I was getting the format specifier error at times, i think its where you hit the api limits, then request a token, gets a bad request, then updates the get features and because its wrong it throws that error.

@xela Also I noticed your missing the -s parameter from your auth - this removes the response stats which messes with the json response

Just a little update…
I’m well on my way to creating the binding and hopefully will have something for you to all test by the end of next week.

1 Like

@Delid4ve Well done sir. Once you get somewhere would you share the code with me? I’d like to see how it’s done

@Fixer of course, once I’ve got it semi working ill put it on git anyhow.
Need a ‘JAVA For Dummies’ Book right now :slight_smile:
Still getting my head around the language.

@Delid4ve Have a look at
https://www.w3schools.com/ I’ve found it good for Perl, Python and PHP.
Never managed to get my head round Java though, just seems so needlessly complex - why do it in five lines of code when fifteen will do lol

that looks alot better than what ive managed to cobble together! I need to sit down and really try and arrange stuff better!

@Fixer @xela @s73ven @Greigc Nearly there…


2 Likes

@delid4ve fantastic work mate well done

Looking good!
Let us know when you want some help with the testing

Wow, great work

@Fixer not far off, maybe even tomorrow as got a free night tonight
Still a long way to go tho

Got a bit delayed getting my head around lists/arrays/Gson but I’m back on track.

1 Like

@Fixer @xela @Greigc @s73ven
Could anyone that has devices other than sockets and also gen1 stuff, and is running my interim script turn on logging for the structure response and pm me the result.
Should be a json starting with group, then devices, featuresets, features

Need it to integrate into the binding.
Shouldn’t take me long to add it in and we are good to go

Will do, but it will be this evening

@Fixer no problem

2020-01-27 09:09:42.001 [TRACE] [ightwaverf.internal.api.LWConnection] - Response: {"message":"Request rate reached limit"} 

100% a limit

I’ve never managed to hit that, but I do see the structure not found messages which seem to be sent after a timeout on the LV side