Bug: 'attempt to index field 'distance' (a nil value)'

I’m currently traveling internationally (from the US) and the last time my iPhone Locator instance correctly updated was while I was in the US (at the airport).

I’m also seeing the MsgText being all messed up.

With DEBUG enabled, it’s clear that the device (iPhone) is returning location data, so I suspect the plugin is having problems calculating the distance (which is now several thousand miles).

50	03/10/15 4:03:36.852	luup_log:235: IPhoneLocator: loop: an error occurred during execution of forceRefresh():[string "local mime = require('mime')..."]:541: attempt to index field 'distance' (a nil value) <0x2d359680>
50	03/10/15 4:03:36.853	luup_log:235: IPhoneLocator: getPeriodForDevice(235) - Distance:263.119 Auto:1 Base:60==>3600 <0x2d359680>
50	03/10/15 4:03:36.864	luup_log:235: IPhoneLocator: Period chosen for device:235 = 3600 <0x2d359680>
06	03/10/15 4:03:36.865	Device_Variable::m_szValue_set device: 235 service: urn:upnp-org:serviceId:IPhoneLocator1 variable: MsgText was: Poll: 2015-03-09 03:31 / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s now: Poll: 2015-03-09 03:31 / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s / 3600 s #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2d359680>

Problem went away when I started using direct as the distance mode.

Interesting that because Google won’t create a set of driving instructions to get to Norway from the US, the plugin isn’t able to calculate a distance and as a result gives up (gracefully)

[quote=“sjolshagen, post:2, topic:186368”]Problem went away when I started using direct as the distance mode.

Interesting that because Google won’t create a set of driving instructions to get to Norway from the US, the plugin isn’t able to calculate a distance and as a result gives up (gracefully)[/quote]

good point I need to check that. in indirect mode, I depend on google but I probably do not check if it fails properly

A related issue was that the ‘time until next update’ on the front-end would only append text (so I wound up with a long list of 3600 entries. One for each hour the plugin tried and failed).

A related issue was that the ‘time until next update’ on the front-end would only append text (so I wound up with a long list of 3600 entries. One for each hour the plugin tried and failed).[/quote]

Hello version 2.3 fixes both issues. it is pending confirmation to be published in the store but in the mean time you can install it by opening this url : http://:3480/data_request?id=action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=CreatePlugin&PluginNum=4686&Version=27068
(ignore the error msg it will produce, they are “normal”). Allow Luup to reload + browser refresh and you should see v2.3 in your UI.

v2.3 is approved