Plugin hanging with large JSON file

Posted on
Mon Mar 06, 2023 5:09 am
siclark offline
Posts: 1963
Joined: Jun 13, 2017
Location: UK

Plugin hanging with large JSON file

Hi Dave

I have just started using this to process sensor readings from my irrigation soil sensors, via their open API.

The issue is, I think, that the API returns all readings for the last 30 days, which is 9 sensor readings per update, and there are approx 1800 updates in the JSON, which means a lot of lines and device custom states.

I can create one GhostXML device and it updates, but when I Try to create a new one, or duplicate the existing one, it times out when I try and Edit Device Settings. Below is what is reorted in the log,

Code: Select all
   Error (client)                  timeout waiting for plugin response from com.fogbert.indigoplugin.GhostXML for request UiGetValues2
   Error (client)                  timeout waiting for plugin response from com.fogbert.indigoplugin.GhostXML for request CallPluginFunc
   Error (client)                  runDialogForDevice() caught exception: NSInvalidArgumentException -- *** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]


Any ideas (that dont involve a custom plugin!)

Cheers
Simon

Posted on
Mon Mar 06, 2023 6:52 am
DaveL17 offline
User avatar
Posts: 6759
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Plugin hanging with large JSON file

Hmmm. As far as I know, no one has reported trouble like this before. That said, it's a very large payload, so most likely at least somewhat unusual. What happens if you create a new device without duplicating an existing one? If that works as expected, then I'd suggest it's a function of the process that Indigo uses to duplicate devices (that happens in Indigo core, not the plugin). Another thing you might try--although I'm not very confident it'll make a difference--is to disable the device you're duplicating before duplicating it.

If neither of those things provides any insight, we can dig further.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Mon Mar 06, 2023 7:15 am
siclark offline
Posts: 1963
Joined: Jun 13, 2017
Location: UK

Re: Plugin hanging with large JSON file

Creating a new device also fails.
It even stops something like Explore Device action on the Grafana plugin which throws same error and the Grafana popup fails to show.

However I've discovered a date filter in the API so I now only pull last 2 days which is a much more sensible amount of data and have no problems.

I'm happy now that it's working but can help you dig if you feel the urge to investigate more.

Posted on
Mon Mar 06, 2023 8:05 am
DaveL17 offline
User avatar
Posts: 6759
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Plugin hanging with large JSON file

siclark wrote:
I'm happy now that it's working but can help you dig if you feel the urge to investigate more.


Glad you found a solution.

Not unless it becomes a wider problem (1,800 states is a lot). As you can imagine, writing something to handle *all* XML and *all* JSON has nuances. :)

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 7 guests