We have moved at community.getvera.com

Author Topic: Devices seem to be "losing sync" in Vera  (Read 10108 times)

Offline dubbedout

  • Full Member
  • ***
  • Posts: 179
  • Karma: +3/-5
Devices seem to be "losing sync" in Vera
« on: November 23, 2015, 10:32:55 pm »
I've posted before about my GE Links and their groups not being in sync with their status with Wink Connect, which isn't that big of a deal but I recently purchased a bunch of Trippers at Home Depot on clearance and they also seem to be losing sync with Vera.  After a certain amount of time their status no longer updates in my Vera but if I do a resync on the plugin they start working again. 

Link to log:
https://www.dropbox.com/s/5rytyfn1mystlw2/WinkConnectLog.txt?dl=0

Offline cybrmage

  • Moderator
  • Hero Member
  • *****
  • Posts: 1104
  • Karma: +113/-43
Re: Devices seem to be "losing sync" in Vera
« Reply #1 on: November 24, 2015, 02:32:20 am »
After a certain amount of time their status no longer updates in my Vera but if I do a resync on the plugin they start working again. 

I found a bug that prevented the status for members of a group from being updated...

The update is posted in the "LATEST VERSION" thread.


I haven't yet found any indication in the logs of what is going wrong with the trippers... I'm Still searching through the log...

Offline dubbedout

  • Full Member
  • ***
  • Posts: 179
  • Karma: +3/-5
Re: Devices seem to be "losing sync" in Vera
« Reply #2 on: November 28, 2015, 01:06:18 pm »
I just noticed that my Wink Relay has disappeared again in Vera with the newest update.  The switches are still showing up but the Relay itself is gone.  Any update on my original issue with devices not updating? 

Offline cybrmage

  • Moderator
  • Hero Member
  • *****
  • Posts: 1104
  • Karma: +113/-43
Re: Devices seem to be "losing sync" in Vera
« Reply #3 on: November 28, 2015, 02:33:21 pm »
I just noticed that my Wink Relay has disappeared again in Vera with the newest update.

My Relay has not disappeared...

If yours has, it must be something to do with the data sent from the Wink API...

Please enable debug mode and post the logs from a restart or resync...

The original issue was the groups not syncing... The potential fix was posted...

Offline dubbedout

  • Full Member
  • ***
  • Posts: 179
  • Karma: +3/-5
Re: Devices seem to be "losing sync" in Vera
« Reply #4 on: November 28, 2015, 02:49:12 pm »
I just noticed that my Wink Relay has disappeared again in Vera with the newest update.

My Relay has not disappeared...

If yours has, it must be something to do with the data sent from the Wink API...

Please enable debug mode and post the logs from a restart or resync...

The original issue was the groups not syncing... The potential fix was posted...

Sorry, I was referring to my issue with devices not updating their status.  I'm using several Trippers to trigger lights and they work for a few minutes after a re-sync but then stop working.

Here's the log: https://www.dropbox.com/s/qpdltky3bbl6rwq/WinkLUUP1.txt?dl=0

Offline cybrmage

  • Moderator
  • Hero Member
  • *****
  • Posts: 1104
  • Karma: +113/-43
Re: Devices seem to be "losing sync" in Vera
« Reply #5 on: November 30, 2015, 01:59:16 am »
Sorry, I was referring to my issue with devices not updating their status.

So... You actually have 3 issues:
1) Group devices lose sync over time.
2) Trippers loses sync over time.
3) Wink Relay Device disappears.

Issue 1 should be resolved with v0.20.13 or later... Are you still seeing the devices lose sync?

Issue 2 and 3 have not been addressed... I've been sidetracked by RGBW device support...

For issue 2, I do not have trippers, so I will need to rely on logs...

For Issue 3, Neither my Wink Relay device, nor any of the related devices, has disappeared...

I'll look at the last provided logs to see if anything looks wrong...

Offline dubbedout

  • Full Member
  • ***
  • Posts: 179
  • Karma: +3/-5
Re: Devices seem to be "losing sync" in Vera
« Reply #6 on: November 30, 2015, 10:50:21 am »
So... You actually have 3 issues:
1) Group devices lose sync over time.
2) Trippers loses sync over time.
3) Wink Relay Device disappears.

Issue 1 should be resolved with v0.20.13 or later... Are you still seeing the devices lose sync?

Issue 2 and 3 have not been addressed... I've been sidetracked by RGBW device support...

For issue 2, I do not have trippers, so I will need to rely on logs...

For Issue 3, Neither my Wink Relay device, nor any of the related devices, has disappeared...

I'll look at the last provided logs to see if anything looks wrong...

Well, the first thing I noticed losing sync was the trippers because I'm using the Smart Switch Plugin to turn on lights using the trippers.  It seems like it's all of my Wink devices that aren't updating.  I just logged into my Vera and noticed all my GE Link lights still show they're on but they were turned off via a scene last night.  To test this theory I watched the UI this morning when Smart Switch turned off my lights after the set time the lights never updated (the group device or individual lights) in Vera.  If I refresh my browser, nothing changes, only performing a re-sync will the devices get the correct status.

Same thing with the Wink Relay, I only noticed it was gone because the lights weren't turning on when it was triggered so I checked the Smart Switch plugin settings and noticed the Wink Relay had completely disappeared from my Vera.

So while v0.20.13 does fix the group issues after the first few minutes of doing a re-sync, everything eventually loses sync no matter what device type it is.

Offline cybrmage

  • Moderator
  • Hero Member
  • *****
  • Posts: 1104
  • Karma: +113/-43
Re: Devices seem to be "losing sync" in Vera
« Reply #7 on: November 30, 2015, 11:41:24 am »
To test this theory I watched the UI this morning when Smart Switch turned off my lights after the set time the lights never updated (the group device or individual lights) in Vera.

Try to capture the LuaUPnP log from when the smart switch plugin commands the lights off and continuing for at least five minutes... I suspect that it is an issue with notifications... When the subscription expires, the pubnub servers are supposed to send a notification, and the plugin renews the subscription... If the notification is not received, further status updates will not be received... I may need to rework the subscription mechanism to automatically do periodic renewals..

Offline dubbedout

  • Full Member
  • ***
  • Posts: 179
  • Karma: +3/-5
Re: Devices seem to be "losing sync" in Vera
« Reply #8 on: November 30, 2015, 12:09:05 pm »
To test this theory I watched the UI this morning when Smart Switch turned off my lights after the set time the lights never updated (the group device or individual lights) in Vera.

Try to capture the LuaUPnP log from when the smart switch plugin commands the lights off and continuing for at least five minutes... I suspect that it is an issue with notifications... When the subscription expires, the pubnub servers are supposed to send a notification, and the plugin renews the subscription... If the notification is not received, further status updates will not be received... I may need to rework the subscription mechanism to automatically do periodic renewals..

Ok, smart switch turned on my Upstairs Hallway lights at 9:48am and turned them off at 9:56am.  I see what looks like errors in updating the status, it states that it "Recieved update data for unconfigured group device" several times at the time the lights are turned off.

Newest log:
https://www.dropbox.com/s/xms9x5oma9e6ry7/WinkLUUP-updates.txt?dl=0

Offline cybrmage

  • Moderator
  • Hero Member
  • *****
  • Posts: 1104
  • Karma: +113/-43
Re: Devices seem to be "losing sync" in Vera
« Reply #9 on: November 30, 2015, 12:32:55 pm »

Ok, smart switch turned on my Upstairs Hallway lights at 9:48am and turned them off at 9:56am.  I see what looks like errors in updating the status, it states that it "Recieved update data for unconfigured group device" several times at the time the lights are turned off.

Newest log:
https://www.dropbox.com/s/xms9x5oma9e6ry7/WinkLUUP-updates.txt?dl=0

I'll have a look at the logs later today...

The "Recieved update data for unconfigured group device" can be caused by a number of issues:
1) You have groups on your Wink account that have unsupported devices in them.
2) You have groups on your Wink account that do not have any devices in them (Strangely, the Wink servers will still send occassional notifications for empty groups).
3) You have groups on your Wink account but have not enabled Group support in the plugin.

This is not an error message, but a debugging message...

Offline cybrmage

  • Moderator
  • Hero Member
  • *****
  • Posts: 1104
  • Karma: +113/-43
Re: Devices seem to be "losing sync" in Vera
« Reply #10 on: November 30, 2015, 02:17:48 pm »
Ok... first... The plugin is crashing... BUT... it is because the Wink API server is not sending data for the group device... (this bug will be corrected in the next release)

As part of setting the state of the group device, The plugin sends the command, and because the Wink API does not return the state of the member devices in the command response, it retrieves the group device list which should contain the current status of the member devices... The response the plugin is receiving does not contain this information...

The reason that a reload (restart the LuaUPnP engine) or resync (erase the maintained device list and recreate it from scratch) will update the individual devices first, then update the main group device, then update the group members... the update routine used in the creation/initialization of devices is seperate from the routine used to process device changes/updates (and does not have the bug). The status of the group members is updated by the individual device status reported in the global device list.

I check the data returned for the scenes on my VeraEdge... There is no data returned by the Wink API for the individual member devices... So this is (ultimately) a Wink API issue, not a plugin issue... However, I should be able to program a workaround... which may take a little while...


Also... I do not see any subscription activity in the logs. I do not see why that is... Will need a restart log to see what is happening with the subscription mechanism... but lets get the group issue fixed first...

Offline cybrmage

  • Moderator
  • Hero Member
  • *****
  • Posts: 1104
  • Karma: +113/-43
Re: Devices seem to be "losing sync" in Vera
« Reply #11 on: December 03, 2015, 12:44:48 pm »
I just posted a new version in the "LATEST VERSION" thread.

During testing, I noticed several issues:
1) The Wink API response to the get group list and device activation command, sometimes does not contain status data for the member devices.
2) The PubNub notification server is sometimes sending a notification with new status data, then immediately sending a notification with old status data.
3) The status of the member devices are sometimes not updated for several seconds after the physical state of the device changes.

I have worked around these issue and the new version will (hopefully) make the status displayed in the Vera UI much more accurate.

Give it a try and let me know the results...

Offline dubbedout

  • Full Member
  • ***
  • Posts: 179
  • Karma: +3/-5
Re: Devices seem to be "losing sync" in Vera
« Reply #12 on: December 05, 2015, 03:27:06 pm »
I just posted a new version in the "LATEST VERSION" thread.

During testing, I noticed several issues:
1) The Wink API response to the get group list and device activation command, sometimes does not contain status data for the member devices.
2) The PubNub notification server is sometimes sending a notification with new status data, then immediately sending a notification with old status data.
3) The status of the member devices are sometimes not updated for several seconds after the physical state of the device changes.

I have worked around these issue and the new version will (hopefully) make the status displayed in the Vera UI much more accurate.

Give it a try and let me know the results...

Doesn't look like the individual devices in the groups are updating, the group device itself is updating but not the single devices that are in the group.  Also, my trippers aren't registering their status either.

I opened the door of my back door tripper and saw nothing in the log, this was around 13:20.  I had my Wink app opened at the time and they are updating with Wink.

https://www.dropbox.com/s/oujqxnhjyutqd37/WinkTrippersLOG.txt?dl=0

Offline cybrmage

  • Moderator
  • Hero Member
  • *****
  • Posts: 1104
  • Karma: +113/-43
Re: Devices seem to be "losing sync" in Vera
« Reply #13 on: December 05, 2015, 05:01:07 pm »
Doesn't look like the individual devices in the groups are updating, the group device itself is updating but not the single devices that are in the group.

When you activated the group, the processing of the response data resulted in the group device status updating, then the processing thread crashed... and the subscription of the device data was not renewed... and the plugin never received the update data for the member devices...

Also, my trippers aren't registering their status either.

The tripper are actually reporting their status... and the plugin is correctly updating the status...
Code: [Select]
02 12/05/15 11:23:41.134 luup_log:16: (Wink_Connect::processDeviceState): Processing Device State update . <0x76b88520>
50 12/05/15 11:23:41.134 luup_log:16: (Wink_Connect::processDeviceState): deviceProcessed [FALSE]. <0x76b88520>
50 12/05/15 11:23:41.135 luup_log:16: (Wink_Connect::HUB_DEVICES::findVeraDeviceByWinkId): Searching for device with Wink ID [126520]. <0x76b88520>
50 12/05/15 11:23:41.136 luup_log:16: (Wink_Connect::HUB_DEVICES::findVeraDeviceByWinkId): found device [15]. <0x76b88520>
50 12/05/15 11:23:41.136 luup_log:16: (Wink_Connect::processDeviceState): updating sensor_pod Tripper device [15] vera [83] hub [204721] connected [TRUE]. <0x76b88520>
50 12/05/15 11:23:41.137 luup_log:16: (Wink_Connect::processDeviceState): updating sensor_pod Tripper device [83] name [Back Door Tripper] status [TRUE] hub [204721] connected [TRUE]. <0x76b88520>
50 12/05/15 11:23:41.137 luup_log:16: (Wink_Connect::setChildVariable) Device [83] SID [urn:micasaverde-com:serviceId:HaDevice1] variable [BatteryLevel] current [100] new [100]. <0x76b88520>
50 12/05/15 11:23:41.138 luup_log:16: (Wink_Connect::setChildVariable) Device [83] SID [urn:micasaverde-com:serviceId:SecuritySensor1] variable [Tripped] current [0] new [1]. <0x76b88520>
50 12/05/15 11:23:41.138 luup_log:16: (Wink_Connect::setChildVariable) Setting urn:micasaverde-com:serviceId:SecuritySensor1::Tripped [1]. <0x76b88520>
06 12/05/15 11:23:41.139 Device_Variable::m_szValue_set device: 83 service: urn:micasaverde-com:serviceId:SecuritySensor1 variable: LastTrip was: 1449253862 now: 1449339821 #hooks: 0 upnp: 0 skip: 0 v:0x996c70/NONE duplicate:0 <0x76b88520>
06 12/05/15 11:23:41.154 Device_Variable::m_szValue_set device: 83 service: urn:micasaverde-com:serviceId:SecuritySensor1 variable: Tripped was: 0 now: 1 #hooks: 1 upnp: 0 skip: 0 v:0x996b38/NONE duplicate:0 <0x76b88520>


The SmartSwitch plugin is then responding to the status change...
Code: [Select]
02 12/05/15 11:23:41.155 luup_log:63: SmartSwitch INFO(sensorTripped@L_SmartSwitch_core.lua:578)) - Sensor tripped: sensorId = 83 (number) <0x76b88520>
02 12/05/15 11:23:41.156 luup_log:63: SmartSwitch INFO(setSwitchLevel@L_SmartSwitch_core.lua:172)) - Setting Switch Level: switchId = 6 (number), level = 0 (number) <0x76b88520>
06 12/05/15 11:23:41.157 Device_Variable::m_szValue_set device: 77 service: urn:hugheaves-com:serviceId:SmartSwitchController1 variable: Level was: 0 now: 0 #hooks: 0 upnp: 0 skip: 0 v:0xb3a960/NONE duplicate:1 <0x76b88520>
08 12/05/15 11:23:41.157 JobHandler_LuaUPnP::HandleActionRequest device: 6 service: urn:upnp-org:serviceId:SwitchPower1 action: SetTarget <0x76b88520>
08 12/05/15 11:23:41.158 JobHandler_LuaUPnP::HandleActionRequest argument newTargetValue=0 <0x76b88520>
06 12/05/15 11:23:41.158 Device_Variable::m_szValue_set device: 6 service: urn:upnp-org:serviceId:SwitchPower1 variable: Target was: 0 now: 0 #hooks: 0 upnp: 0 skip: 0 v:0x986bf8/NONE duplicate:1 <0x76b88520>
06 12/05/15 11:23:41.160 Device_Variable::m_szValue_set device: 77 service: urn:hugheaves-com:serviceId:SmartSwitchController1 variable: Mode was: Off now: Auto #hooks: 0 upnp: 0 skip: 0 v:0xb39c78/NONE duplicate:0 <0x76b88520>
06 12/05/15 11:23:41.160 Device_Variable::m_szValue_set device: 77 service: urn:hugheaves-com:serviceId:SmartSwitchController1 variable: Timeout was: 2147483647 now: 2147483647 #hooks: 0 upnp: 0 skip: 0 v:0xb39f50/NONE duplicate:1 <0x76b88520>

The reason you are not seeing anything around 13:20 is that the plugin has not renewed the subscription to notifications (due to the crash) and never receives the status updates...

Attached is a quick update to correct the crash... (you only need to upload the L_Wink_Hub1.lua file to your Vera)...
« Last Edit: December 13, 2017, 01:48:23 am by cybrmage »

Offline dubbedout

  • Full Member
  • ***
  • Posts: 179
  • Karma: +3/-5
Re: Devices seem to be "losing sync" in Vera
« Reply #14 on: December 05, 2015, 07:01:17 pm »
Ok, so with this update I noticed trippers were updating fine, groups were being weird though.  When I turn on the group lights manually in VeraUI it turns on all the individual lights but then the group device still shows off..then everything stops updating.

I walked through my house with my laptop and tested my trippers and they worked fine, as soon as I do anything with a group of lights it seems like the plugin crashes because nothing updates any longer.

https://www.dropbox.com/s/kp7i1roln6nllrv/WinkGroupsLOG.txt?dl=0