GhostXML reading states from Bluesound (BluOS) Network

Posted on
Wed Jun 10, 2020 11:48 pm
Wizard Sleeve offline
Posts: 34
Joined: Feb 11, 2008
Location: Berkshire, United Kingdom

GhostXML reading states from Bluesound (BluOS) Network

Hi

I am not sure if in looking in the right place for this but just discovered your plugin.

I have several bluesound network players that I want to pull state information from. from their API document it seems pretty simple and I can easily get responses in my browser. Just not sure how to get that in to device states just yet.

If I send:

http://<PlayerIP>:11000/Volume

i get a response of:

<volume db="-79.2" mute="0" offsetDb="0" etag="ad6ceaae9212b58f910dcbe6d49a7bdb">2</volume>

its the "2" i want at the end of the string >2</volume>

ive tried setting your plugin with the above URL and in the debug log it looks like its reading something:

GhostXML Debug HTTPS CURL result: * Trying 10.0.1.160...
* TCP_NODELAY set
* Connected to 10.0.1.160 (10.0.1.160) port 11000 (#0)
> GET /Volume HTTP/1.1
> Host: 10.0.1.160:11000
> User-Agent: curl/7.54.0
> Accept: */*
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 ok
< Connection: close
< Access-Control-Allow-Origin: *
< Content-Length: 148
< Cache-Control: max-age=0
< Content-Type: text/xml; charset=utf-8
< Date: Thu, 11 Jun 2020 05:39:08 GMT
< Expires: Thu, 11 Jun 2020 05:39:08 GMT
<
{ [148 bytes data]
* Closing connection 0

GhostXML Debug ReturnCode: 0

I assume the content length means its reading the above string. I just have no idea what to do now or if im even looking down the right channel.

Thanks

Lee

Posted on
Thu Jun 11, 2020 4:58 am
DaveL17 offline
User avatar
Posts: 5909
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: GhostXML reading states from Bluesound (BluOS) Network

Hello - there are two types of GhostXML devices, one parses all API data into text (strings) and the second tries to coerce the API data into data types text, numbers, and booleans. My recommendation is to try the former first, but if you used the latter--no matter. Once configured and online, the plugin queries the API at the set interval and puts that data into custom states (as you mentioned). Those are found in the panel below the device details pane:

Screen Shot 2020-06-11 at 5.37.14 AM.png
Screen Shot 2020-06-11 at 5.37.14 AM.png (27.75 KiB) Viewed 468 times


You can use these states in Indigo directly. To access the portion of the individual state, you're going to need to use a little Python (or another plugin to convert the data for you). Here's some example Python code to help you get started:
Code: Select all
#! /usr/bin/env python
# -*- coding: utf-8 -*-

x = -79.2
y = "-79.2"

print(int(str(x).split('.')[-1]))
print(y[-1])

I hope that answers your question.

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 1 guest