How to fix "The data couldn't be read because..." error

Posted on
Thu Dec 17, 2015 3:29 am
Gary_BBGames offline
Posts: 146
Joined: Sep 14, 2015

How to fix "The data couldn't be read because..." error

Home Remote 2.9 is out now, but some of you might experience an error that says "The data couldn't be read because it isn't in the correct format" after trying to connect to your Indigo server.

There is an issue with the Indigo Mac app that allows you to paste carriage returns and tabs into a device or action name, the results of which is illegal JSON that cannot be parsed by iOS.

I do some string manipulation to fix it, but some combinations will slip through - especially tabs, which will be fixed in the next update.

You can resolve the issue yourself by going to http://indigoIP:indigoPort/devices.json in your browser and copying the results you see there in to the site http://jsonlint.com.

Once your data is there, press "Validate" and see if the JSON is valid. If it finds an error it will tell you the name of the action that is causing problems. Search the data for it and then fix the name in the Indigo Mac app. Try to reconnect to Indigo in Home Remote for iOS and it should work.

It might say that your devices.json file is fine, in which case the issue is with http://indigoIP:indigoPort/actions.json. Repeat the above steps with the contents of this file instead to resolve the issue.

Posted on
Tue Feb 23, 2016 4:53 am
DaveL17 offline
User avatar
Posts: 4848
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: How to fix "The data couldn't be read because..." error

HI Gary - I may have found another way to generate this error--having double-qotes in the Indigo notes field.

When the notes field contains double-quotes, the Indigo JSON doesn't throw any errors on JSON Lint, but I do get the "Data couldn't be read error" on Home Remote. Removing the double-quotes clears the error notification. Also, this may be expected, but with the "Data couldn't be read error" (double-quotes in the notes field) I don't get confirmation that the action has run on the Today Screen. When I take the double-quotes out of the notes field, I do get confirmation. I can reproduce this behavior.

This causes the error to throw:
Code: Select all
Up before "Good Morning" schedule.
This doesn't:
Code: Select all
Up before Good Morning schedule.
Cheers!
Dave

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

[My Plugins] - [My Forums]

Posted on
Tue Feb 23, 2016 5:03 am
Gary_BBGames offline
Posts: 146
Joined: Sep 14, 2015

Re: How to fix "The data couldn't be read because..." error

Argh! If possible could you let Jay or Matt know they are generating illegal JSON their side when they allow this please? They should be escaping any values like that. I'll try and add a check, but not sure I will be able to as the " is used all over the place.

Posted on
Tue Feb 23, 2016 6:28 am
DaveL17 offline
User avatar
Posts: 4848
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: How to fix "The data couldn't be read because..." error

Can do!

Dave


Sent from my iPhone using Tapatalk

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

[My Plugins] - [My Forums]

Posted on
Tue Feb 23, 2016 10:44 am
jay (support) offline
Site Admin
User avatar
Posts: 15473
Joined: Mar 19, 2008
Location: Austin, Texas

Re: How to fix "The data couldn't be read because..." error

Sigh. We hacked the JSON stuff in a couple of years ago and didn't really do a thorough job of it. I was hoping my last hack on hack fix would keep us from having to do the real fix until we moved IWS into a true plugin.

I'll look to see if there's any way to a faster solution for this particular problem.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Feb 23, 2016 5:21 pm
jay (support) offline
Site Admin
User avatar
Posts: 15473
Joined: Mar 19, 2008
Location: Austin, Texas

Re: How to fix "The data couldn't be read because..." error

Ok, I just bit the bullet and replaced the JSON generation in the RESTful API with Python's json module. So after the next release, any bugs in the json generation can get blamed on Python!

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Feb 23, 2016 7:01 pm
DaveL17 offline
User avatar
Posts: 4848
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: How to fix "The data couldn't be read because..." error

Thanks Jay!


Sent from my iPhone using Tapatalk

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

[My Plugins] - [My Forums]

Posted on
Wed Feb 24, 2016 5:02 am
Gary_BBGames offline
Posts: 146
Joined: Sep 14, 2015

Re: How to fix "The data couldn't be read because..." error

Jay, thanks so much for that. Will be interesting to see what the results are :)

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest