Lightwaverf API

@Adrian_Rockall

Adrian! This is fantastic! It works!!! I’m at work but I’ve successfully added devices! Thanks so much!
All my devices other than the home and away button and the three gang dimmer are visible and added!

We should try to get Lightwave to send you some devices without you having to order them; you’re being generous enough as it is with your time…

FYI, these are the logs now the devices have been

@David_Thomas
Excellent, so pleased its working.
I will look into the three gang dimmer. I probably just need to add the relevant product code.

P.S. I’m not sure how sensitive those codes are so maybe you should edit your post add take out the logs. I think they are useless without the Bearer ID but better be safe.

@Adrian_Rockall

Thanks! I’ve edited out those codes. One question - when you run your app on your system, does it automatically update the status (power on/power off) of devices and the energy meter to trigger flows, etc?

It doesn’t on mine - Just trying to work out whether that’s something that I still need to get to work or if its just a case of this being a feature that hasn’t been coded yet and I need to be patient :slight_smile:

Interesting that the Home / Away has a product code and that’s the one I thought might be causing the problem. However, there is a device that’s not returning a product code so I think that might be your missing 3 gang dimmer. I’m not sure why the format is different for that. I did notice it had an “upgrade”: “yes” so maybe it needs to have the firmware updated.

It should request an update when first connecting and then gets updates via a webhook after that. I use a flow that picks up a dimmer being switched off and switches off a z-wave light. I must admit I don’t think I tested the flows using the energy meter so I will test that soon.

You could try restarting the app now you have devices add just in case my changes have broken the web hook initialisation at inclusion.

Good spot re the firmware upgrade! I’ve done this now, much to my wife’s dismay as the lights started flashing while she was cooking :wink:

Still no luck with the three gang dimmer or updating status though; even after a restart of the app; I think I’m missing some of the functionality that you have in that if I switch on or off a dimmer, say via the Lightwave app, Homey doesn’t ‘see’ that that is has happened. Good to know that this is possible, though; hopefully an easy fix.

FYI the latest debug is as follows; nothing obvious to suggest webhooks isn’t working.

Starting LW appInitialising Bridge
Waiting for Bridge #0
Waiting for Bridge #1
Waiting for Bridge #2
Waiting for Bridge #3
Waiting for Bridge #4
Waiting for Bridge #5
Waiting for Bridge #6
Waiting for Bridge #7
Waiting for Bridge #8
Waiting for Bridge #9
Waiting for Bridge #10
Waiting for Bridge #11
Old LW Webhooks Deleted
Bridge Initialised
Registering Homey WEBHook
Bridge Ready #0
Bridge Ready #1
Bridge Ready #2
Bridge Ready #3
Bridge Ready #4
Bridge Ready #5
Bridge Ready #6
Bridge Ready #7
Bridge Ready #8
Bridge Ready #9
Bridge Ready #10
Bridge Ready #11

I can’t see why the webhook is not working so I will add some more diagnostics message to the next beta. I will also remove the (possibly) sensitive codes from the output.
My dimmers feedback within a second or two so I can stand next to the dimmer, with the phone on the Homey devices page, press a button on the dimmer and the phone updates as I look back at it. It’s difficult to time it as Homey fades the tile in and out.

I wonder if the 3 gang dimmer is causing any other issues as I can’t see why it has incomplete information being sent back. Just out of interest, in the Lightwave App for each entry of the three gang dimmer, does it show the code in there, e.g. “L23”. The single gang should show “L21” so you can see where it should be.

Can you post the contents of the unsupported devices field and I will try to contact LW to see if they have any explanation (that field has no sensitive information by the way). They might say you have to contact them so you can give them account details to allow them to check your devices.

Thanks; yes Lightwave shows the code L23.

Unsupported devices code follows below.

[

{

“device”: {

“identify”: “Yes”,

“reset”: “Yes”,

“upgrade”: “Yes”,

“diagnostics”: “Yes”,

“periodOfBroadcast”: “Yes”,

“rgbColor”: “Yes”,

“switch”: “Yes”,

“dimLevel”: “Yes”,

“dimSetup”: “Yes”,

“protection”: “Yes”,

“power”: “Yes”,

“energy”: “Yes”

}

},

{

“device”: {

“switch”: “Yes”,

“dimLevel”: “Yes”,

“dimSetup”: “Yes”,

“protection”: “Yes”,

“power”: “Yes”,

“energy”: “Yes”

}

},

{

“device”: {

“switch”: “Yes”,

“dimLevel”: “Yes”,

“dimSetup”: “Yes”,

“protection”: “Yes”,

“power”: “Yes”,

“energy”: “Yes”

}

},

{

“device”: {

“productCode”: “L2”,

“device”: “LinkPlus”,

“desc”: “Central Hub”,

“type”: “lwrfTwoWay_v2”,

“cat”: “Hub”,

“gen”: 2,

“currentTime”: “Yes”,

“buttonPress”: “Yes”,

“time”: “Yes”,

“date”: “Yes”,

“monthArray”: “Yes”,

“weekdayArray”: “Yes”,

“timeZone”: “Yes”,

“locationLongitude”: “Yes”,

“locationLatitude”: “Yes”,

“duskTime”: “Yes”,

“dawnTime”: “Yes”,

“rgbColor”: “Yes”,

“day”: “Yes”,

“month”: “Yes”,

“year”: “Yes”,

“weekday”: “Yes”

}

},

{

“device”: {

“productCode”: “LW929”,

“device”: “N/A”,

“desc”: “Home & Away Remote”,

“type”: “lwrfTwoWay_v1”,

“cat”: “Sensors”,

“gen”: 1,

“buttonPress”: “Yes”,

“rssi”: “Yes”

}

},

{

“device”: {

“productCode”: “LW929”,

“device”: “N/A”,

“desc”: “Home & Away Remote”,

“type”: “lwrfTwoWay_v1”,

“cat”: “Sensors”,

“gen”: 1,

“buttonPress”: “Yes”

}

}

]

And of course, please do let me know if I can help in any way…

@Adrian_Rockall Were Lightwave any help? Happy to contact them if you like.

I have not heard anything yet. It might be an idea if you contact them and ask them to check your devices in their database. Mention that your three gang dimmer does not appear to be returning all the information to the API call. You could even send them the snippet from the settings screen as you have posted it above. The critical bit that I need is the “productCode”.

Just out of interest, what names have you given the dimmers on that three gang unit?
I’m just wondering if there is a character that is confusing the JSON parser.

I have added more diagnostic message to the log and in doing so I have noticed that I seem to get reports from a socket device ID that does not exist in my house. I am currently trying to track that down as the webhook should only send responses for each users own devices. The Athom server should filter messages based on the users unique Bearer ID. So it’s probably some obscure mistake I’ve made when the event (webhook) is registered with LW.

While I’m working on the new version I wounder if another Diagnostic Report will show anything. Could you restart the app, wait for about 2 to 3 minutes then create the report like you did last time?

I have received my Home / Away remote but I am struggling to decide what capability to give it. LW report the two buttons separately so it shows as two devices, one for Home and one for Away. I tried setting them as buttons in Homey but it turns out Homey treats that as sending a command and not receiving and LW don’t accept a command as it is read only. Also LW send an ON followed immediately by an OFF so any user interface is too slow to show the action. I can get them working to trigger flows as a generic alarm but that just looks wrong. So I think I shall have to delve deeper into a custom capability which is a bit more learning for me.

Thanks very much Adrian; I’ve now messaged them.

My device names are “Far lights”, “Middle lights”, and “Kitchen light”.

I’ll run the diagnostic shortly.

The new diagnostic code is 1eade107-7a39-4d7c-9004-9283627752a7

Thanks Adrian!

I have request a new beta to be published with the following changes:

  • Updated bridge methods for better queuing of transactions.
  • Updated the settings page so the log is on a separate tab.
  • Added an option to switch logging off.
  • Log data panel is now refreshed when new data arrives.
  • Changed WebHook function to filter on a different parameter.

Nothing strange there then so that rules out another theory.

The diagnostics feedback shows an error is thrown which I think is in the Homey core. It appears to take issue with the WebHook data as it’s trying to convert it to an object ready to send to the App.
Unfortunately I can’t see the raw data in the report so I have no idea what LW is sending that confuses Homey.
I have reported the error to Athom to see if they can shed any light on the matter, or at least catch the error so it doesn’t kill the app.

The new beta might help as I have simplified the filter parameters in the WebHook. Also the extra logging might show something.

Hopefully LightWave can find a solution for your account. As far as I know you are the only one having problems which makes me think there is an issue at their end but I won’t give up as I don’t like being defeated :grinning:

I still haven’t added the Home / Away remote yet as I want to get the current stuff working for you first.

Athom have informed me that the error is thrown when the webhook is registered due to bad data. This data should come from the Bearer ID setting but the value being passed in is nothing like a valid bearer ID. Not sure why that should be though.

Anyway the new beta has just been published and this uses a different set of parameters to setup the webhook so it may solve the problem.

I have also re-written the way it queues message by going through a single instance of the bridge interface. This should prevent a race condition when the access token expires.

The settings page has been updated so the log is now in a separate tab with options to switch it on and off and if webhook message should be logged, plus there is a Clear button to easily erase the log. It also supports live refresh so it will display new entries as they appear.
The app also logs more information to help diagnose problems should they occur.

@David_Thomas I recommend updating to this version to see if it helps with your webhook issue.
Have you had any feedback from LW?

Brilliant thanks Adrian. Nothing yet from Lightwave unfortunately.

New log extracted below

Starting LW app

Searching for devices of type: dimmer

Found Location: 5bf33a0328b22a79b290b5eb-5bf33a0328b22a79b290b5ec

Found devices: undefined

Found devices: L2

Found devices: L21

Correct Device Type.

Logging Feature Set: 5bf33a0328b22a79b290b5eb-5bf33a2f28b22a79b290cc8a

Found devices: L42

Wrong device type

Found devices: L42

Wrong device type

Found devices: L42

Wrong device type

Found devices: LW929

Registering LW Webhook

Registering LW Webhook

Registering LW Webhook

Registering LW Webhook

Connection Failed: Error: {“message”:“Request Error: Notification already exists”}

LW Webhook failed

Connection Failed: Error: {“message”:“Request Error: Notification already exists”}

LW Webhook failed

Connection Failed: Error: {“message”:“Request Error: Notification already exists”}

LW Webhook failed

Connection Failed: Error: {“message”:“Request Error: Notification already exists”}

LW Webhook failed

Can you switch all the logging options on and then restart the app? Then we should see the full startup procedure.

Certainly

Starting LW app

--------- App InitBridge --------

Initialising Bridge

Deleting LW WebHooks

Waiting for Bridge #0

Waiting for Bridge #1

Waiting for Bridge #2

Waiting for Bridge #3

Waiting for Bridge #4

Waiting for Bridge #5

Waiting for Bridge #6

Waiting for Bridge #7

Waiting for Bridge #8

Waiting for Bridge #9

Waiting for Bridge #10

Waiting for Bridge #11

LW WEBHooks Deleted

Bridge Initialised

Waiting for Bridge #12

Location: _5bf33a0328b22a79b290b5eb-

Registering Homey WEBHook

WebHook data: {

“id”: “_5bf33a0328b22a79b290b5eb-”

}

Bridge Ready #6

Bridge Ready #7

Bridge Ready #8

Bridge Ready #9

Bridge Ready #10

Bridge Ready #11

Registering LW Webhook

Registering LW Webhook

Registering LW Webhook

Registering LW Webhook

Registering LW Webhook

Registering LW Webhook

Registering LW Webhook

Registering LW Webhook

Registering LW Webhook

Registering LW Webhook

Registering LW Webhook

Registering LW Webhook

Registering LW Webhook

Registering LW Webhook

Registering LW Webhook

Registering LW Webhook

Registering LW Webhook

Registering LW Webhook

Bridge Ready #12

Bridge Ready #0

Bridge Ready #1

Bridge Ready #2

Bridge Ready #3

Bridge Ready #4

Bridge Ready #5

Registering LW Webhook

Registering LW Webhook

Registering LW Webhook

Registering LW Webhook

Registered LW Webhook

Registered LW Webhook

Registered LW Webhook

Registered LW Webhook

Registered LW Webhook

Registered LW Webhook

Registered LW Webhook

Registered LW Webhook

Registered LW Webhook

Registered LW Webhook

Registered LW Webhook

Registered LW Webhook

Registered LW Webhook

Registered LW Webhook

Registered LW Webhook

Registered LW Webhook

Registered LW Webhook

Registered LW Webhook

Registered LW Webhook

Registered LW Webhook

Registered LW Webhook

Registered LW Webhook

That all looks OK.
If you enable the “Log Webhook Messages” do you get “Webhook found Device” messages appearing?

@David_Thomas just wondering how it’s going?
Did you get a response from LW?
Are your devices now getting updates?