New Plugin: GhostXML

Posted on
Mon Feb 27, 2017 3:17 pm
Grevling offline
Posts: 28
Joined: Feb 06, 2017
Location: Norway

Re: New Plugin: GhostXML

Hi,

Totally new to Indigo and home automation, and am about half way trough my trial period.

I´m looking to get some weather data up on my control pages to be, and am experimenting with this plugin for that purpose, as the Norwegian weather service YR.NO offers free xml weather data. Is there a good way to get the XML data on to the control page as text and symbols? Do I have construct complicated variables and make custom icons for all types of weather to go with them for this purpose, or is there an easier way?

I realise this is probably a stupid question, but I have searched the forum extensively, and great as it is I have not come across a good way to implement data from a local weather provider on to the control page. :roll:

Any pointers are welcome.

Thanks

Posted on
Mon Feb 27, 2017 4:33 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: New Plugin: GhostXML

Hi and welcome!

If you create a device using this plugin and add your xml feed to it, you should see reasonable data under the device - have a look at post 133 above for a screenshot - several users, myself included, don't find that panel until they're told it's there!

Once you see that data, you can start adding it to a control page.

In your devices images folder (ask if you need path) save icons called:

Weather+sunny.png
Weather+cloudy.png
Weather+.png (this is default)

There's an icon pack on the weatherunderground plugin page if you want to steal that.

Now on your control page, add a 'device state' (think that's its name) to your page, pick your ghostxml weather device, and pick whichever state contains the text description e.g. "Sunny", "cloudy" or the Norwegian equivalents. For image source, pick weather+.png and Indigo will substitute the value from your xml into the image name if it finds a match.

Probably read the weather underground plugin threads - the core features are there, you're just using GhostXML for the data instead of that plugin.

Peter


Sent from my iPhone using Tapatalk

Posted on
Mon Feb 27, 2017 4:57 pm
DaveL17 offline
User avatar
Posts: 6742
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: New Plugin: GhostXML

You should be able to use the GhostXML plugin to get the data as Peter expertly explained, but you may find that local data are available from Weather Underground directly. I would recommend using the WUnderground Plugin if that is available to you. It does much of the heavy lifting for you and has been shown to work in your neck of the woods. :D

If you find that the GhostXML plugin is your preferred approach, don't hesitate to post here with any other questions you might have.

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 28, 2017 2:11 am
Grevling offline
Posts: 28
Joined: Feb 06, 2017
Location: Norway

Re: New Plugin: GhostXML

Hi

Thanks to both of you for good pointers.
The XML data returned from my local weatherprovider is pretty extencive to say the least, and not so easy to interpret eigther.

I'll give the WU plugin a wihrl first then, and check the forcast accuracy in my area. I have a netatmo station wich I appearently can hook up to WU for sharing data as well if I have understood the service correctly.

Thanks again

G

Posted on
Tue Feb 28, 2017 5:08 am
DaveL17 offline
User avatar
Posts: 6742
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: New Plugin: GhostXML

Good luck!

Because you can never have too many options (okay, you probably can) there's a plugin called Adapters Plugin which allows you to transform data into other forms as you wish. For example, it can convert temperatures F to C, or amend values to change '10C' to '10 °C' and so on. So if you find some data element isn't quite to your liking, there are ways to fix that.

Yes, my understanding is that you can connect Netatmo to Weather Underground. There is also the WUnderstation plugin which allows data upload as well, which allows any variety of devices to be connected to Weather Underground.

Cheers,
Dave

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

[My Plugins] - [My Forums]

Posted on
Sun Jul 09, 2017 10:50 pm
dtich offline
Posts: 798
Joined: Sep 24, 2005

Re: New Plugin: GhostXML - getting data from sma webbox, hel

hello all, any help you can provide would be most appreciated !

i've setup a ghostxml dev with type: json; url: http://192.168.0.98/rpc={"version": "1.0","password":"password","proc": "GetPlantOverview", "id": "1","format": "JSON"}

this is the format as noted in the dev manual* for the webbox (without the password param, but returns same without). but, as i said, i'm completely un-versed in this. so..

it's returning errors:

GhostXML Error sma sunny webbox: No JSON object could be decoded
GhostXML Error Error cleaning dictionary keys: 'NoneType' object has no attribute 'iterkeys'

is there something obvious i'm doing wrong?

*http://files.sma.de/dl/2585/SWebBoxRPC-BA-en-14.pdf

thanks!




Code: Select all
Jul 9, 2017, 9:38:43 PM
   GhostXML Debug                  User prefs saved.
   GhostXML                        Debugging on (Level: 3)
   GhostXML Debug                  valuesDict: UiValuesDict : (dict)
     configMenuPollInterval : 300 (string)
     configMenuServerTimeout : 15 (string)
     infoLabel0 :  (string)
     refreshFreq : 300 (integer)
     sep2 :  (string)
     sep3 :  (string)
     sep4 :  (string)
     showDebugInfo : true (bool)
     showDebugLevel : 3 (integer)
     space0 :  (string)
     space10 :  (string)
     space11 :  (string)
     space4 :  (string)
     space5 :  (string)
     space6 :  (string)
     space7 :  (string)
     space8 :  (string)
     space9 :  (string)
     updaterEmail : admin@domain.net, dtich@domain.net (string)
     updaterEmailsEnabled : true (bool)
     updaterLastCheck : 1499659392 (real)
   GhostXML Debug                   
   GhostXML Debug                  sma sunny webbox:
   GhostXML Debug                      Time since update: 421
   GhostXML Debug                   
   GhostXML Debug                  sma sunny webbox:
   GhostXML Debug                      Time since update: 426
   GhostXML Debug                  refreshData() method called.
   GhostXML Debug                  Updating data...
   GhostXML Debug                  Found configured device: sma sunny webbox
   GhostXML Debug                     sma sunny webbox is enabled.
   GhostXML Debug                  Refreshing device: sma sunny webbox
   GhostXML Debug                  getTheData() method called.
   GhostXML Debug                  *   Trying 192.168.0.98...
* Connected to 192.168.0.98 (192.168.0.98) port 80 (#0)
> GET /rpc="version": "1.0" HTTP/1.1
> Host: 192.168.0.98
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: Sunny WebBox
< Cache-Control: no-store, no-cache, max-age=0
< Date: Mon, 10 Jul 2017 04:38:52 GMT
< Pragma: no-cache
< Connection: keep-alive
< Keep-Alive: 300
< Content-Type: text/html
< Content-Length: 685
<
{ [685 bytes data]
* Connection #0 to host 192.168.0.98 left intact
* Found bundle for host 192.168.0.98: 0x7fcc23702100
* Re-using existing connection! (#0) with host 192.168.0.98
* Connected to 192.168.0.98 (192.168.0.98) port 80 (#0)
> GET /rpc="password":"passwrd" HTTP/1.1
> Host: 192.168.0.98
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: Sunny WebBox
< Cache-Control: no-store, no-cache, max-age=0
< Date: Mon, 10 Jul 2017 04:38:52 GMT
< Pragma: no-cache
< Connection: keep-alive
< Keep-Alive: 300
< Content-Type: text/html
< Content-Length: 685
<
{ [685 bytes data]
* Connection #0 to host 192.168.0.98 left intact
* Found bundle for host 192.168.0.98: 0x7fcc23702100
* Re-using existing connection! (#0) with host 192.168.0.98
* Connected to 192.168.0.98 (192.168.0.98) port 80 (#0)
> GET /rpc="proc": "GetPlantOverview" HTTP/1.1
> Host: 192.168.0.98
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: Sunny WebBox
< Cache-Control: no-store, no-cache, max-age=0
< Date: Mon, 10 Jul 2017 04:38:52 GMT
< Pragma: no-cache
< Connection: keep-alive
< Keep-Alive: 300
< Content-Type: text/html
< Content-Length: 685
<
{ [685 bytes data]
* Connection #0 to host 192.168.0.98 left intact
* Found bundle for host 192.168.0.98: 0x7fcc23702100
* Re-using existing connection! (#0) with host 192.168.0.98
* Connected to 192.168.0.98 (192.168.0.98) port 80 (#0)
> GET /rpc= "id": "1" HTTP/1.1
> Host: 192.168.0.98
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: Sunny WebBox
< Cache-Control: no-store, no-cache, max-age=0
< Date: Mon, 10 Jul 2017 04:38:52 GMT
< Pragma: no-cache
< Connection: keep-alive
< Keep-Alive: 300
< Content-Type: text/html
< Content-Length: 685
<
{ [685 bytes data]
* Connection #0 to host 192.168.0.98 left intact
* Found bundle for host 192.168.0.98: 0x7fcc23702100
* Re-using existing connection! (#0) with host 192.168.0.98
* Connected to 192.168.0.98 (192.168.0.98) port 80 (#0)
> GET /rpc="format": "JSON" HTTP/1.1
> Host: 192.168.0.98
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: Sunny WebBox
< Cache-Control: no-store, no-cache, max-age=0
< Date: Mon, 10 Jul 2017 04:38:52 GMT
< Pragma: no-cache
< Connection: keep-alive
< Keep-Alive: 300
< Content-Type: text/html
< Content-Length: 685
<
{ [685 bytes data]
* Connection #0 to host 192.168.0.98 left intact

   GhostXML Debug                  Source file type: JSON
   GhostXML Debug                  parseTheJSON() method called.
   GhostXML Error                  sma sunny webbox: No JSON object could be decoded
   GhostXML Error                  Error cleaning dictionary keys: 'NoneType' object has no attribute 'iterkeys'
   GhostXML Debug                   
   GhostXML Debug                  sma sunny webbox:
   GhostXML Debug                      Time since update: 0

Posted on
Mon Jul 10, 2017 3:54 am
DaveL17 offline
User avatar
Posts: 6742
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: New Plugin: GhostXML - getting data from sma webbox, hel

Hi Ditch - have you tried to enter the username and password combination in the device settings? They can be found under the Enable Digest Auth? setting in the device configuration dialog.

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

[My Plugins] - [My Forums]

Posted on
Mon Jul 10, 2017 10:46 am
dtich offline
Posts: 798
Joined: Sep 24, 2005

Re: New Plugin: GhostXML

have yes, same errors with that. would you like to see new debug log?

thank you!

Posted on
Mon Jul 10, 2017 10:58 am
dtich offline
Posts: 798
Joined: Sep 24, 2005

Re: New Plugin: GhostXML

so, i changed the internal file format on the webbox to xml (from csv), and set the ghostxml dev to file type 'xml' (from json), and now the device seems to download and is enabled and green, but log gives:

seems to be dl'ing an html page..? and no useable variables? not sure here...

Code: Select all
     deviceStartComm() method called.
   GhostXML                        Starting GhostXML device: sma sunny webbox
   GhostXML Debug                  getDeviceStateList() method called.
   GhostXML Debug                  Device has been updated. Blow state list up to Trigger and Control Page labels.
   GhostXML Debug                   
   GhostXML Debug                  sma sunny webbox:
   GhostXML Debug                      Time since update: 11
   GhostXML Debug                  refreshData() method called.
   GhostXML Debug                  Updating data...
   GhostXML Debug                  Found configured device: sma sunny webbox
   GhostXML Debug                     sma sunny webbox is enabled.
   GhostXML Debug                  Refreshing device: sma sunny webbox
   GhostXML Debug                  getTheData() method called.
   GhostXML Debug                  *   Trying 192.168.0.98...
* Connected to 192.168.0.98 (192.168.0.98) port 80 (#0)
* Server auth using Digest with user ''
> GET /rpc="version": "1.0" HTTP/1.1
> Host: 192.168.0.98
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: Sunny WebBox
< Cache-Control: no-store, no-cache, max-age=0
< Date: Mon, 10 Jul 2017 16:54:52 GMT
< Pragma: no-cache
< Connection: keep-alive
< Keep-Alive: 300
< Content-Type: text/html
< Content-Length: 685
<
{ [685 bytes data]
* Connection #0 to host 192.168.0.98 left intact
* Found bundle for host 192.168.0.98: 0x7fc28a506850
* Re-using existing connection! (#0) with host 192.168.0.98
* Connected to 192.168.0.98 (192.168.0.98) port 80 (#0)
* Server auth using Digest with user ''
> GET /rpc="proc": "GetPlantOverview" HTTP/1.1
> Host: 192.168.0.98
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: Sunny WebBox
< Cache-Control: no-store, no-cache, max-age=0
< Date: Mon, 10 Jul 2017 16:54:52 GMT
< Pragma: no-cache
< Connection: keep-alive
< Keep-Alive: 300
< Content-Type: text/html
< Content-Length: 685
<
{ [685 bytes data]
* Connection #0 to host 192.168.0.98 left intact
* Found bundle for host 192.168.0.98: 0x7fc28a506850
* Re-using existing connection! (#0) with host 192.168.0.98
* Connected to 192.168.0.98 (192.168.0.98) port 80 (#0)
* Server auth using Digest with user ''
> GET /rpc= "id": "1" HTTP/1.1
> Host: 192.168.0.98
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: Sunny WebBox
< Cache-Control: no-store, no-cache, max-age=0
< Date: Mon, 10 Jul 2017 16:54:52 GMT
< Pragma: no-cache
< Connection: keep-alive
< Keep-Alive: 300
< Content-Type: text/html
< Content-Length: 685
<
{ [685 bytes data]
* Connection #0 to host 192.168.0.98 left intact
* Found bundle for host 192.168.0.98: 0x7fc28a506850
* Re-using existing connection! (#0) with host 192.168.0.98
* Connected to 192.168.0.98 (192.168.0.98) port 80 (#0)
* Server auth using Digest with user ''
> GET /rpc="format": "JSON" HTTP/1.1
> Host: 192.168.0.98
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: Sunny WebBox
< Cache-Control: no-store, no-cache, max-age=0
< Date: Mon, 10 Jul 2017 16:54:52 GMT
< Pragma: no-cache
< Connection: keep-alive
< Keep-Alive: 300
< Content-Type: text/html
< Content-Length: 685
<
{ [685 bytes data]
* Connection #0 to host 192.168.0.98 left intact

   GhostXML Debug                  Source file type: XML
   GhostXML Debug                  stripNamespace() method called.
   GhostXML Debug                  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <title>Sunny WebBox</title>
      <link href="css/style.css" type="text/css" rel="stylesheet">
   </head>
   <body>
      <Font Face="Arial, Helvetica, sans-serif" Size="3">
         <div align="center">
            <br>
            <br>
            <b>
               <br>
               <br>
               <Font Size="4" color="#AA0000">File ExpectationFailed</Font>
               <br>
               <br>
               BuildAndSendResponse<br> file: temp\wwwroot\<br>BuildAndSendResponse failed
            </b>
            <br>
            <br>
            <img src="image\error.jpg" alt="ERROR">
         </div>
      </Font>
   </body>
</html><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <title>Sunny WebBox</title>
      <link href="css/style.css" type="text/css" rel="stylesheet">
   </head>
   <body>
      <Font Face="Arial, Helvetica, sans-serif" Size="3">
         <div align="center">
            <br>
            <br>
            <b>
               <br>
               <br>
               <Font Size="4" color="#AA0000">File ExpectationFailed</Font>
               <br>
               <br>
               BuildAndSendResponse<br> file: temp\wwwroot\<br>BuildAndSendResponse failed
            </b>
            <br>
            <br>
            <img src="image\error.jpg" alt="ERROR">
         </div>
      </Font>
   </body>
</html><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <title>Sunny WebBox</title>
      <link href="css/style.css" type="text/css" rel="stylesheet">
   </head>
   <body>
      <Font Face="Arial, Helvetica, sans-serif" Size="3">
         <div align="center">
            <br>
            <br>
            <b>
               <br>
               <br>
               <Font Size="4" color="#AA0000">File ExpectationFailed</Font>
               <br>
               <br>
               BuildAndSendResponse<br> file: temp\wwwroot\<br>BuildAndSendResponse failed
            </b>
            <br>
            <br>
            <img src="image\error.jpg" alt="ERROR">
         </div>
      </Font>
   </body>
</html><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <title>Sunny WebBox</title>
      <link href="css/style.css" type="text/css" rel="stylesheet">
   </head>
   <body>
      <Font Face="Arial, Helvetica, sans-serif" Size="3">
         <div align="center">
            <br>
            <br>
            <b>
               <br>
               <br>
               <Font Size="4" color="#AA0000">File ExpectationFailed</Font>
               <br>
               <br>
               BuildAndSendResponse<br> file: temp\wwwroot\<br>BuildAndSendResponse failed
            </b>
            <br>
            <br>
            <img src="image\error.jpg" alt="ERROR">
         </div>
      </Font>
   </body>
</html>
   GhostXML                        There was an parse error. Check XML source.
   GhostXML Debug                  Device needs updating set to: True
   GhostXML Debug                  getDeviceStateList() method called.
   GhostXML Debug                  Pulling down existing state list.
   GhostXML Debug                    Writing dynamic states to device.
   GhostXML Debug                  [u'Response']
   GhostXML Debug                  ['Response']
   GhostXML Debug                  True
   GhostXML Debug                  Device needs updating set to: False
   GhostXML Debug                  parseStateValues() method called.
   GhostXML Debug                  Writing device states:
   GhostXML Debug                     Response = Parse error. Check XML source.
   GhostXML Debug                  sma sunny webbox updated.
   GhostXML Debug                   
   GhostXML Debug                  sma sunny webbox:
   GhostXML Debug                      Time since update: 4
   GhostXML Debug                   
   GhostXML Debug                  sma sunny webbox:
   GhostXML Debug   

Posted on
Mon Jul 10, 2017 3:57 pm
DaveL17 offline
User avatar
Posts: 6742
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: New Plugin: GhostXML

Hmmm, okay. Please enter the following URL in a web browser and see what we get:

http://192.168.0.98/rpc

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

[My Plugins] - [My Forums]

Posted on
Mon Jul 10, 2017 4:20 pm
dtich offline
Posts: 798
Joined: Sep 24, 2005

Re: New Plugin: GhostXML

that brings me to the html interface... oddly. hm.

i must have the syntax wrong on the json call. but.. it seems clear. something i'm not seeing.

Posted on
Mon Jul 10, 2017 4:53 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: New Plugin: GhostXML

https://uk.mathworks.com/matlabcentral/ ... hworks.com

Your box needs a http POST containing the JSON request{} you posted above, which it then replies to with a JSON response.

Not sure (Dave?) if we can post JSON to an endpoint in this plugin?


Sent from my iPhone using Tapatalk Pro

Posted on
Mon Jul 10, 2017 4:56 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: New Plugin: GhostXML

https://github.com/jraedler/SunnyWebBox ... yWebBox.py

Should work as a script or plugin with some tweaking.


Sent from my iPhone using Tapatalk Pro

Posted on
Mon Jul 10, 2017 5:55 pm
dtich offline
Posts: 798
Joined: Sep 24, 2005

Re: New Plugin: GhostXML

thanks a lot for the tips.

i've got that python compiling and running, but... embarrassingly, i don't know how to get variables out of it...

Posted on
Mon Jul 10, 2017 6:33 pm
DaveL17 offline
User avatar
Posts: 6742
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: New Plugin: GhostXML

I understand now why the GhostXML plugin can't get to this data directly. The capacity could be added, but to do it right would require some effort and unfortunately I don't have the bandwidth to take on anything new at the moment.

I agree that the referenced code could be leveraged into a script or plugin without too much effort (the script has a BSD license, so it should be okay to use it.) If you save a copy of the script to a place that Indigo can see it, it should be possible to import the script as a module and work with the return in your own script. I realize that this is easier said than done! :D

If in the coming weeks you're still needing some help, we'll see what we can do.

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

[My Plugins] - [My Forums]

Page 10 of 20 1 ... 7, 8, 9, 10, 11, 12, 13 ... 20

Who is online

Users browsing this forum: No registered users and 0 guests