use custom states from a ghost xml device

Posted on
Sat Dec 07, 2019 10:08 am
howartp offline
Posts: 3861
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: use custom states from a ghost xml device

Exception handling?

What is this phrase of which you speak?




Sent from my iPhone using Tapatalk Pro

Posted on
Sat Dec 07, 2019 12:27 pm
matt (support) offline
Site Admin
User avatar
Posts: 19523
Joined: Jan 27, 2003
Location: Texas

Re: use custom states from a ghost xml device

DaveL17 wrote:
I'm still working on getting a matplotlib plugin bug fix tested (hang in there Bert!) but my initial suspicion is that many of the Alpha Vantage keys start with a character or series of characters that Indigo doesn't like.

Indigo Dicts do have some additional restrictions compared to native python dicts. See this forum post for the details (including restrictions on key naming).

Image

Posted on
Sat Dec 07, 2019 12:35 pm
howartp offline
Posts: 3861
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: use custom states from a ghost xml device

Keys cannot start with a number....

That would be the problem then....


Sent from my iPhone using Tapatalk Pro

Posted on
Sat Dec 07, 2019 1:14 pm
wideglidejrp offline
User avatar
Posts: 491
Joined: Jan 15, 2012
Location: Danbury, CT

Re: use custom states from a ghost xml device

Looks like AV not Indigo compliant in two ways: starts with a number AND has a space....

"Meta Data": {
"1. Information": "Intraday (5min) open, high, low, close prices and volume",
"2. Symbol": "UBER",
"3. Last Refreshed": "2019-12-06 16:00:00",
"4. Interval": "5min",
"5. Output Size": "Compact",
"6. Time Zone": "US/Eastern"
},
"2019-12-06 15:55:00": {
"1. open": "27.9062",
"2. high": "27.9569",
"3. low": "27.8868",
"4. close": "27.9312",
"5. volume": "735363"

John R Patrick
Author of
Home Attitude

Posted on
Sat Dec 07, 2019 1:31 pm
howartp offline
Posts: 3861
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: use custom states from a ghost xml device

The plugin deals with spaces already, I saw that earlier in the code.


Sent from my iPhone using Tapatalk Pro

Posted on
Sat Dec 07, 2019 2:55 pm
howartp offline
Posts: 3861
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: use custom states from a ghost xml device

Right, it's not the numbers or the nesting causing the problem.

However, once the plugin has got stuck, if you edit the device, Indigo throws an error:

Error (client) _setCurrentPluginDeviceType() caught exception: LowLevelBadParameterError -- illegal character in XML tag name or value


So I played about with a local copy of the JSON.

If you remove the colon symbol, it allows the plugin to 'finish' and display "Updated" - but the states don't appear, and the errror above still occurs.

So you also need to remove the decimal point symbol, which allows the states to appear and the plugin to work correctly.

Dave, line 818 just needs : and . adding to the chars_to_replace dictionary.

However be aware that as the state names are so long ("Time_Series_5min_2019_minus_12_minus_06_15_55_00_5__volume"), you can't actually see the value of the state in the UI. (You can in control pages etc)

Peter

Posted on
Sat Dec 07, 2019 4:02 pm
DaveL17 offline
User avatar
Posts: 5185
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: use custom states from a ghost xml device

Peter -- a quick check confirms that the changes seem to work. I'll get something pulled together and push an update. Thank you!

John -- your quest will result in the plugin being even better, so thank you for that.

FYI -- If you hover over a custom state, a help bubble will display both the full name and the state value. I suspect there may be a character limit.

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

[My Plugins] - [My Forums]

Posted on
Sat Dec 07, 2019 5:09 pm
DaveL17 offline
User avatar
Posts: 5185
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: use custom states from a ghost xml device

I have posted an update to the plugin that should work with the Alpha Vantage API.

https://forums.indigodomo.com/viewtopic.php?f=249&t=18109#p175629

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

[My Plugins] - [My Forums]

Posted on
Sat Dec 07, 2019 5:47 pm
wideglidejrp offline
User avatar
Posts: 491
Joined: Jan 15, 2012
Location: Danbury, CT

Re: use custom states from a ghost xml device

Great! Works perfectly. Now that I see how things work, I realize I picked the wrong query for what I am trying to do. When I figure out the right one to use, I am sure the plugin will work. Thanks very much for developing this.

John R Patrick
Author of
Home Attitude

Posted on
Sat Dec 07, 2019 7:53 pm
DaveL17 offline
User avatar
Posts: 5185
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: use custom states from a ghost xml device

Good deal. Glad to hear that the update is working for you.

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

[My Plugins] - [My Forums]

Posted on
Mon Dec 09, 2019 11:12 am
wideglidejrp offline
User avatar
Posts: 491
Joined: Jan 15, 2012
Location: Danbury, CT

Re: use custom states from a ghost xml device

Thanks for this great plugin. I would like to share how I am using it. Still experimenting, but it is working really well. Between the NYSE hours of 9:30 to 4:00, the plugin grabs the latest price of UBER stock using an Alpha Vantage JSON API. If the price is higher than the opening price, the Aeotec LED strip turns green across the top of my office ceiling. If the price falls below the opening price, the strip turns red. The possibilities of using the real-time data from Alpha Vantage are endless.
Attachments
IMG_0363.jpeg
IMG_0363.jpeg (59.34 KiB) Viewed 129 times
IMG_0362.jpeg
IMG_0362.jpeg (58.01 KiB) Viewed 129 times

John R Patrick
Author of
Home Attitude

Posted on
Mon Dec 09, 2019 3:40 pm
DaveL17 offline
User avatar
Posts: 5185
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: use custom states from a ghost xml device

Check that out. That's awesome! Thanks for sharing John.

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

[My Plugins] - [My Forums]

Who is online

Users browsing this forum: No registered users and 1 guest

cron