New Plugin: GhostXML

Posted on
Sat Mar 30, 2019 6:55 pm
russg offline
Posts: 46
Joined: Oct 02, 2014

Re: New Plugin: GhostXML

Hmmm.... Now, when I open the config window, I get. the same dialog as before (with the red warning message on the bottom left) and it won't allow me to save and continue. However, there is no error in the event log.

Am I doing something stupid?

I can create devices now, so I'll play with that.
thanks!
-russg

Posted on
Sun Mar 31, 2019 4:52 am
DaveL17 offline
User avatar
Posts: 6742
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: New Plugin: GhostXML

russg wrote:
Am I doing something stupid?

That would be me. Please try 0.4.25 in the plugin store. The config dialog should now close without complaint.

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

[My Plugins] - [My Forums]

Posted on
Sun Mar 31, 2019 7:12 pm
russg offline
Posts: 46
Joined: Oct 02, 2014

Re: New Plugin: GhostXML

Yup, that did it. Thanks!

Posted on
Sun Mar 31, 2019 7:43 pm
DaveL17 offline
User avatar
Posts: 6742
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: New Plugin: GhostXML

Great. I hope the plugin will get you what you need.

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

[My Plugins] - [My Forums]

Posted on
Thu May 16, 2019 2:39 am
Rjay offline
Posts: 41
Joined: Feb 12, 2019

Re: New Plugin: GhostXML

Stumbled across this plugin and thought it might work for a use case I have.

I have a Seneye Aquarium Monitor which I wouldn't mind pulling the info in from to display on a dashboard

API Details can be found here - https://api.seneye.com/api/resources/view/q/device_get

and results from an API request in the browser are attached

When I enter the URL into a GhostXML device if I choose XML it comes up with a parse error and if I specify json it doesn't come up with an error but I am not sure what I am supposed to be seeing. Should there be an automatically created variable with the content of the API response in it?

I couldn't find too many examples in the wiki or the json/xml format sample files that were mentioned on one of the pages

thanks
Attachments
Output.png
Output.png (77.58 KiB) Viewed 3420 times

Posted on
Thu May 16, 2019 5:50 am
DaveL17 offline
User avatar
Posts: 6742
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: New Plugin: GhostXML

Hi Rjay - that file is definitely XML (Safari noted that at the top of your screen grab). When you selected JSON for that source within the plugin, you should get an error--perhaps it's being written to the plugin log instead of the Indigo events log. (I'll need to take a look at that.) A cursory look at what you shared doesn't show an obvious reason why it wouldn't parse properly as XML, but I can't see the entire payload from what you provided.

From the API documents, you have to enter a username and password in the URL to request the data. So, if you enter a URL to request the data in one of the following formats:

XML:
Code: Select all
https://api.seneye.com/v1/devices/3442?user=<username>&pwd=<password>

JSON:
Code: Select all
https://api.seneye.com/v1/devices/3442?IncludeState=1&user=<username>&pwd=<password>


that gives you a parse error from the plugin?

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

[My Plugins] - [My Forums]

Posted on
Thu May 16, 2019 7:49 am
Rjay offline
Posts: 41
Joined: Feb 12, 2019

Re: New Plugin: GhostXML

yep understood the format was def XML. and yep the parse error is what I see when using that API format.

I think the documentation is a little bit funky there in terms of both those commands (with or without the include state ) can deliver json or xml I believe just depends on what you specify in the header.

When the GhostXML device is working correctly what happens with the data that arrives from the import? does it get assigned to a variable(s)?

Posted on
Thu May 16, 2019 7:52 am
DaveL17 offline
User avatar
Posts: 6742
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: New Plugin: GhostXML

It gets assigned to custom device states.


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
Thu May 16, 2019 8:20 am
Rjay offline
Posts: 41
Joined: Feb 12, 2019

Re: New Plugin: GhostXML

Thanks DaveL17, think I understand now after doing a bit of reading about what those are.

Now once they get assigned, where in the Indigo interface can you view what those states are? I couldn't really tell from the screenshot on the wiki where that was.

What do you thinknext step for troubleshooting would be?

cheers

Posted on
Thu May 16, 2019 9:03 am
DaveL17 offline
User avatar
Posts: 6742
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: New Plugin: GhostXML

Rjay wrote:
Thanks DaveL17, think I understand now after doing a bit of reading about what those are.

Now once they get assigned, where in the Indigo interface can you view what those states are? I couldn't really tell from the screenshot on the wiki where that was.

What do you thinknext step for troubleshooting would be?

cheers

So that is the bane of existence now in newer versions of OS X, Apple decided that none of us need scroll bars and have turned them off by default.

The custom device states are located beneath the status pane for the selected device (only plugin devices have custom device states.) You can see them by scrolling that part of the window or expanding the size of the Indigo UI to make them visible:

Screen Shot 2019-05-16 at 10.03.11 AM.png
Screen Shot 2019-05-16 at 10.03.11 AM.png (48.96 KiB) Viewed 3372 times


As you can see, I've turned my scroll bars back on in system preferences. :D

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

[My Plugins] - [My Forums]

Posted on
Thu May 16, 2019 11:23 pm
Rjay offline
Posts: 41
Joined: Feb 12, 2019

Re: New Plugin: GhostXML

Now we are talking! Yep that was a combo of MacOS and knowing where to look on my part to . I literally only have a Mac to run Indigo so wasn't familiar with the recent scroll bar changes.

Ok that looks fine I can now see that with it set to JSON with that include state element in the API request it loads a bunch of custom states which I should hopefully now be able to address and get into a form that will work for the dashboard.

With the selector set to XML or JSON does it make any difference to the way GhostXML plugin makes the request or purely instructs the plugin on the way to handle the returned payload?

I have now written some python that sends that device custom state to an Indigo variable :)

thanks

Posted on
Fri May 17, 2019 3:55 am
DaveL17 offline
User avatar
Posts: 6742
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: New Plugin: GhostXML

Rjay wrote:
With the selector set to XML or JSON does it make any difference to the way GhostXML plugin makes the request or purely instructs the plugin on the way to handle the returned payload?

Thanks for reporting back. Good to hear that it's working for you.

Yes, there should be no difference between XML and JSON from the standpoint of custom states generated. A word of caution in case you didn't pick it up from the documentation. All the custom states are stored as strings, so if you are going to use them for logic (math, True/False), you'll need to convert them first.

Can I ask why you're putting the state values into a variable? You should be able to access the states for things like triggers without the intermediate step.

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

[My Plugins] - [My Forums]

Posted on
Fri May 17, 2019 8:35 am
Rjay offline
Posts: 41
Joined: Feb 12, 2019

Re: New Plugin: GhostXML

ahhh k, yeh just thought there might be something different in the request e.g. the json request specifies json in the headers to ensure the payload returned is json.

ahh I did stumble over that in my reading but to be honest I didn't really register what it meant at the time but now I fully understand what your saying. My initial plan wasn't to do any calcs with it but I may need to eventually. The device has a replaceable slide in it that has to changed out every month so I think the way the date is returned by the API needs some conversion for it to be useful to humans so might need to do some conversion there.

Plan initially is just to be able to display some of the readings on a dashboard that has some other controls such as topping up the tank or turning pumps on and off. That way I don't have to log into the web control panel or view on phone all the time.

thanks for your help and assistance to understand how the plugin worked

Posted on
Fri May 17, 2019 8:47 am
DaveL17 offline
User avatar
Posts: 6742
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: New Plugin: GhostXML

Of course. If you have any questions or need help linking the states to automation, let me know.


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
Sun Oct 04, 2020 2:01 pm
SearchCz offline
Posts: 172
Joined: Sep 18, 2019

Re: New Plugin: GhostXML

Trying to use this plugin to tap into a Canadian weather service, specifically for frost and freeze alerts.

I have your plugin installed, but when I try to create a GhostXML device for this feed I get a status of "started" or "processing" ... and a bunch of errors in my server log.

Oct 4, 2020 at 3:57:20 PM
GhostXML Error General exception: LowLevelBadParameterError -- illegal character in XML tag name or value
Traceback (most recent call last):
File "plugin.py", line 1151, in refresh_data_for_dev
dev.stateListOrDisplayStateIdChanged()
StandardError: LowLevelBadParameterError -- illegal character in XML tag name or value
Error (client) _setCurrentPluginDeviceType() caught exception: LowLevelBadParameterError -- illegal character in XML tag name or value
GhostXML Error General exception: LowLevelBadParameterError -- illegal character in XML tag name or value
Traceback (most recent call last):
File "plugin.py", line 1151, in refresh_data_for_dev
dev.stateListOrDisplayStateIdChanged()
StandardError: LowLevelBadParameterError -- illegal character in XML tag name or value

I've attached a screen shot of the feed.

Is that feed defective? They call it an ATOM feed but it looks like XML to me.
Attachments
Screen Shot 2020-10-04 at 3.53.22 PM.png
Screen Shot 2020-10-04 at 3.53.22 PM.png (383.52 KiB) Viewed 2814 times

Who is online

Users browsing this forum: No registered users and 1 guest