Jump to content

Chromecast Polyglot NodeServer


beninsteon

Recommended Posts

Update from the Polyglot store did not work since you apparently mess with server.json so in order to update from the polyglot - I needed to "git checkout ." first. 

Anyway - status in programs is fixed :)

 

Screen Shot 2018-07-20 at 4.46.42 PM.png

Link to comment
Share on other sites

9 hours ago, firstone said:

I have the same (or similar) problem with my own "production" polyglot. It functions fine but looses all status labels. Development seems to always work fine but it's only working for short time usually. I'll get to the bottom of it.

I wonder if this could also be related to the incorrect online/offline reporting?

Link to comment
Share on other sites

18 hours ago, xKing said:

Update from the Polyglot store did not work since you apparently mess with server.json so in order to update from the polyglot - I needed to "git checkout ." first. 

Anyway - status in programs is fixed :)

 

Can you elaborate? I update version and description in server.json. Am I doing something wrong?

 

Or does polyglot update fail because server.json timestamp is different?

Link to comment
Share on other sites

Amazing, whatever you did in 0.4.5 fixed the issue. All chromecast devices are now being reported as "online: true". Chromecast device status is available in conditions to trigger events. Status updates immediately when I trigger something via the ISY.

Is it possible to decrease the polling interval for status updates, or receive status updates automatically (push) from the Chromecast? Right now, it takes several seconds to get a status update from a chromecast device. I plan on using this plugin to control my amplifier power state based on chromecast playstate. A several second delay after playing begins (plus the time it takes for the amp to warm up) is relatively long before the music starts.

Finally, as xKing has said, updating the plugin is difficult. The steps I've had to take are as follows:
1. delete AVRemote from Polyglot dahsboard
2. uninstall AVRemote from store tab
3. install new version of AVRemote via polyglot store
4. SSH into RPi and delete polyinterface and pyyaml lines from requirements.txt
5. Reinstall polyinterface v2.0.28 each time per xKings instructions
6. run install.sh
7. Add AVRemote to Polyglot via web interface

This works reliably but seems like a lot of steps :)

Thanks!

Ben

Link to comment
Share on other sites

Also, a couple additional features, if possible, would be great:

-report back to ISY which app the chromecast device is running (none, Spotify, Google Play Music, Youtube, Netflix, default media receiver, etc)
-report back to ISY artist, track name
-report back to ISY current volume level (%)
-allow discreet volume level control (i.e. set volume to x%), in addition to current volume stepping that's allowed.

Thanks again,

Ben

Link to comment
Share on other sites

12 minutes ago, beninsteon said:

Also, a couple additional features, if possible, would be great:

-report back to ISY which app the chromecast device is running (none, Spotify, Google Play Music, Youtube, Netflix, default media receiver, etc)
-report back to ISY artist, track name
-report back to ISY current volume level (%)
-allow discreet volume level control (i.e. set volume to x%), in addition to current volume stepping that's allowed.

Thanks again,

Ben

Here's the deal with status updates. Status is updated right after command executed or on short poll.

If you don't see status updated right after command, it's possible device is not updating yet. I've put 1 sec sleep between command and update. Perhaps it needs to be bumped to 2 or 3. I will make it configurable. 

Short poll - not related to executed command - can be configured in polyglot dashboard. I think it defaults to 15 sec. You can make it smaller but keep in mind it's a load on your network. But I think 5 sec is perfectly fine. Edit. After re-reading your post, short poll is what you need to adjust for status updates not triggered in ISY.

As for your other request, the latter 2 are easy.

The former 2 are hard - you cannot send arbitrary strings to ISY. It has to be pre-configured and pre-loaded (and requires Admin Console restart). 

So app can be possibly added, if you pre-configured them in dashboard, similar to play lists. Find the command with pychromecast where it reports it. I don't have regular chromecast. Mine doesn't seem to report app. But just paste it here and I'll make blind change.

 

Artist and track name is even harder. Unless you, again, create those values by hand. Polyglot framework doesn't really support it right now.

Link to comment
Share on other sites

56 minutes ago, beninsteon said:

Finally, as xKing has said, updating the plugin is difficult. The steps I've had to take are as follows:
1. delete AVRemote from Polyglot dahsboard
2. uninstall AVRemote from store tab
3. install new version of AVRemote via polyglot store
4. SSH into RPi and delete polyinterface and pyyaml lines from requirements.txt
5. Reinstall polyinterface v2.0.28 each time per xKings instructions
6. run install.sh
7. Add AVRemote to Polyglot via web interface

 

We'll try to figure out why you cannot just update. But:

You should be able to just go into ~/.polyglot/nodeservers/RESTRemote and run 'git pull origin/master'.

polyinterface can also be linked locally, instead of updating your global installation by hand. 

Not sure about pyyaml problem. That one you have to sort out on your own.

Link to comment
Share on other sites

1 hour ago, firstone said:

Can you elaborate? I update version and description in server.json. Am I doing something wrong?
Or does polyglot update fail because server.json timestamp is different?

if I do "git pull" and then start the node server, subsequent "git status" will show that server.json has changed after the "git pull", therefore new "git pull" will fail as there are local changes. Either don't touch server.json programmatically or add it to .gitignore

Link to comment
Share on other sites

4 hours ago, xKing said:

if I do "git pull" and then start the node server, subsequent "git status" will show that server.json has changed after the "git pull", therefore new "git pull" will fail as there are local changes. Either don't touch server.json programmatically or add it to .gitignore

Can you try to do 'git diff'? git shouldn't pick it up as changed if the content is the same. And it should only change when version or drivers change. So unless you make some explicit change, git shouldn't pick it up.

 

I'll separate generation command away from install but trying to understand what it could be.

 

Also, I've used to have it in .gitignore but polyglot store needs it.

Link to comment
Share on other sites

Sure

pi@rpi3:/home/poly/.polyglot/nodeservers/AVRemote $ git diff
diff --git a/server.json b/server.json
index a588443..95b492f 100644
--- a/server.json
+++ b/server.json
@@ -1,27 +1,27 @@
 {
-    "name": "AVRemote",
-    "docs": "https://github.com/firstone/RESTRemote/blob/master/README.md",
     "type": "python3",
-    "executable": "polyrestremote.py --serverConfig cfg/server_config.yaml",
+    "docs": "https://github.com/firstone/RESTRemote/blob/master/README.md",
     "install": "install.sh",
+    "name": "AVRemote",
+    "notice": "https://github.com/firstone/RESTRemote/blob/master/LICENSE",
     "shortPoll": 15,
+    "executable": "polyrestremote.py --serverConfig cfg/server_config.yaml",
     "longPoll": 60,
-    "description": "Universal A/V remote control. Supported: nVidia Shield, LG TV, Tivo, Denon AVR, Onkyo AVR, ESP8266 IR, Chromecast (exp)",
-    "notice": "https://github.com/firstone/RESTRemote/blob/master/LICENSE",
+    "description": "Universal A/V remote control. Supported: Chromecast (exp), LG TV, Tivo, nVidia Shield, Onkyo AVR, Denon AVR, ESP8266 IR",
     "credits": [
         {
+            "version": "0.4.5",
             "title": "A/V Remote",
             "author": "FirstOne",
             "source": "https://github.com/firstone/RESTRemote",
-            "license": "https://github.com/firstone/RESTRemote/blob/master/LICENSE",
-            "version": "0.4.5"
+            "license": "https://github.com/firstone/RESTRemote/blob/master/LICENSE"
         },
         {
-            "title": "udi-poly-template-python: A Polyglot v2 Poly template",
             "author": "James Milne (Einstein.42)",
+            "source": "https://github.com/Einstein42/udi-poly-template-python",
             "version": "2.0.0",
+            "title": "udi-poly-template-python: A Polyglot v2 Poly template",
             "date": "November 8, 2017",
-            "source": "https://github.com/Einstein42/udi-poly-template-python",
             "license": "https://raw.githubusercontent.com/Einstein42/udi-poly-template-python/master/LICENSE"
         }
     ]

 

Link to comment
Share on other sites

FYI, I restarted the nodeserver and for some reason it's not initializing any devices other than "bedroom speakers" (online) and "ceiling speakers" (status), even though it finds all the devices:

2018-07-21 19:52:05,529 DEBUG    Received stop from Polyglot... Shutting Down.
2018-07-21 19:52:05,530 INFO     Disconnecting from MQTT... localhost:1883
2018-07-21 19:52:05,533 INFO     MQTT Graceful disconnection.
2018-07-21 19:52:21,995 INFO     Received Config from STDIN.
2018-07-21 19:52:21,996 INFO     UDI Polyglot v2 Interface 2.0.28 Starting...
2018-07-21 19:52:23,772 INFO     Connecting to MQTT... localhost:1883
2018-07-21 19:52:23,830 INFO     MQTT Connected with result code 0 (Success)
2018-07-21 19:52:23,831 INFO     MQTT Subscribing to topic: udi/polyglot/ns/4 -  MID: 1 Result: 0
2018-07-21 19:52:23,832 INFO     MQTT Subscribing to topic: udi/polyglot/connections/polyglot -  MID: 2 Result: 0
2018-07-21 19:52:23,833 INFO     Sent Connected message to Polyglot
2018-07-21 19:52:23,926 INFO     Sending typed parameters to Polyglot.
2018-07-21 19:52:36,030 INFO     Loaded Chromecast driver
2018-07-21 19:52:36,033 INFO     Adding node Front room home(d_9)
2018-07-21 19:52:36,036 INFO     Loaded Chromecast driver
2018-07-21 19:52:36,037 INFO     Adding node Ceiling speakers(d_6)
2018-07-21 19:52:36,040 INFO     Loaded Chromecast driver
2018-07-21 19:52:36,042 INFO     Adding node Living room speakers(d_11)
2018-07-21 19:52:36,045 INFO     Loaded Chromecast driver
2018-07-21 19:52:36,046 INFO     Adding node zBedroom(d_0)
2018-07-21 19:52:36,050 INFO     Loaded Chromecast driver
2018-07-21 19:52:36,051 INFO     Adding node zLivingRoom(d_2)
2018-07-21 19:52:36,055 INFO     Loaded Chromecast driver
2018-07-21 19:52:36,056 INFO     Adding node Family room TV(d_10)
2018-07-21 19:52:36,059 INFO     Loaded Chromecast driver
2018-07-21 19:52:36,060 INFO     Adding node Kitchen home(d_5)
2018-07-21 19:52:36,063 INFO     Loaded Chromecast driver
2018-07-21 19:52:36,064 INFO     Adding node zBasement(d_12)
2018-07-21 19:52:36,068 INFO     Loaded Chromecast driver
2018-07-21 19:52:36,069 INFO     Adding node Basement Speakers(d_3)
2018-07-21 19:52:36,071 INFO     Loaded Chromecast driver
2018-07-21 19:52:36,073 INFO     Adding node Upstairs home(d_8)
2018-07-21 19:52:36,076 INFO     Loaded Chromecast driver
2018-07-21 19:52:36,077 INFO     Adding node Bedroom speakers(d_7)
2018-07-21 19:52:36,080 INFO     Loaded Chromecast driver
2018-07-21 19:52:36,081 INFO     Adding node zCeilingSpeakers(d_4)
2018-07-21 19:52:36,086 DEBUG    Regenerating profile
2018-07-21 19:52:36,138 DEBUG    Profile has changed. Updating
2018-07-21 19:52:36,138 INFO     Sending Install Profile command to Polyglot.
2018-07-21 19:52:39,887 INFO     Loaded Chromecast driver
2018-07-21 19:52:39,889 INFO     Adding node Front room home(d_9)
2018-07-21 19:52:39,896 INFO     Loaded Chromecast driver
2018-07-21 19:52:39,899 INFO     Adding node Ceiling speakers(d_6)
2018-07-21 19:52:39,905 INFO     Loaded Chromecast driver
2018-07-21 19:52:39,907 INFO     Adding node Living room speakers(d_11)
2018-07-21 19:52:39,915 INFO     Loaded Chromecast driver
2018-07-21 19:52:39,919 INFO     Adding node zBedroom(d_0)
2018-07-21 19:52:39,925 INFO     Loaded Chromecast driver
2018-07-21 19:52:39,927 INFO     Adding node zLivingRoom(d_2)
2018-07-21 19:52:39,933 INFO     Loaded Chromecast driver
2018-07-21 19:52:39,935 INFO     Adding node Family room TV(d_10)
2018-07-21 19:52:39,943 INFO     Loaded Chromecast driver
2018-07-21 19:52:39,945 INFO     Adding node Kitchen home(d_5)
2018-07-21 19:52:39,952 INFO     Loaded Chromecast driver
2018-07-21 19:52:39,954 INFO     Adding node zBasement(d_12)
2018-07-21 19:52:39,958 INFO     Loaded Chromecast driver
2018-07-21 19:52:39,960 INFO     Adding node Basement Speakers(d_3)
2018-07-21 19:52:39,964 INFO     Loaded Chromecast driver
2018-07-21 19:52:39,966 INFO     Adding node Upstairs home(d_8)
2018-07-21 19:52:39,969 INFO     Loaded Chromecast driver
2018-07-21 19:52:39,970 INFO     Adding node Bedroom speakers(d_7)
2018-07-21 19:52:39,974 INFO     Loaded Chromecast driver
2018-07-21 19:52:39,976 INFO     Adding node zCeilingSpeakers(d_4)
2018-07-21 19:52:39,979 INFO     Updating Driver d_7 - ST: 1, uom: 2
2018-07-21 20:50:24,018 INFO     Updating Driver d_6 - GV0: 0.0, uom: 25

nothing after 20:50:24...

I assume that's why there's no online reporting or status for the other devices.

Ben

Link to comment
Share on other sites

11 hours ago, firstone said:

I think polyglot keeps the state and will not update if it thinks state haven't changed. But I'll take a look at your earlier logs.

 

Thanks, but if the state is blank shouldn't it try to get something?

Ben

Link to comment
Share on other sites

It seems like there's a problem connecting to one of your devices and that might have locked up whole node server. At least I don't see any communications but attempts to connect. That's controlled by pychromecast but I'll see if I can turn off this behavior.

2018-07-21 13:20:05,255 ERROR    WARNING:pychromecast.socket_client:Heartbeat timeout, resetting connection
2018-07-21 13:20:06,440 ERROR    ERROR:pychromecast.socket_client:Failed to connect, retrying in 5.0s
2018-07-21 13:20:11,446 WARNING  /home/pi/.local/lib/python3.5/site-packages/pychromecast/socket_client.py:239: ResourceWarning: unclosed <socket.socket fd=29, family=AddressFamily.AF_INET, type=2049, proto=0, laddr=('192.168.0.122', 55946)>
2018-07-21 13:20:11,447 ERROR    WARNING:py.warnings:/home/pi/.local/lib/python3.5/site-packages/pychromecast/socket_client.py:239: ResourceWarning: unclosed <socket.socket fd=29, family=AddressFamily.AF_INET, type=2049, proto=0, laddr=('192.168.0.122', 55946)>
2018-07-21 13:20:17,684 WARNING  /home/pi/.local/lib/python3.5/site-packages/pychromecast/socket_client.py:239: ResourceWarning: unclosed <socket.socket fd=30, family=AddressFamily.AF_INET, type=2049, proto=0, laddr=('192.168.0.122', 55948)>
2018-07-21 13:20:17,685 ERROR    WARNING:py.warnings:/home/pi/.local/lib/python3.5/site-packages/pychromecast/socket_client.py:239: ResourceWarning: unclosed <socket.socket fd=30, family=AddressFamily.AF_INET, type=2049, proto=0, laddr=('192.168.0.122', 55948)>
2018-07-21 13:20:23,924 WARNING  /home/pi/.local/lib/python3.5/site-packages/pychromecast/socket_client.py:239: ResourceWarning: unclosed <socket.socket fd=29, family=AddressFamily.AF_INET, type=2049, proto=0, laddr=('192.168.0.122', 55952)>
2018-07-21 13:20:23,925 ERROR    WARNING:py.warnings:/home/pi/.local/lib/python3.5/site-packages/pychromecast/socket_client.py:239: ResourceWarning: unclosed <socket.socket fd=29, family=AddressFamily.AF_INET, type=2049, proto=0, laddr=('192.168.0.122', 55952)>

 

Link to comment
Share on other sites

I tried to update to the current version from 0.3.3 and I ran into a "pullRepo:undefined" error. So I uninstalled, deleted the AVRemote folder on the Pi and attempted to reinstall. After adding the server, it starts up but after a minute or two disconnects. When I look at the configuration it is empty which is different than I recall happening before. I remember adding my second Onkyo but I thought there were default, empty values already in the configuration file.

The AVRemote log ends with the following:

  • 2018-07-22 19:21:12,572 ERROR --- Logging error ---
  • 2018-07-22 19:21:12,572 ERROR ERROR:polyinterface.polyinterface:--- Logging error ---
  • 2018-07-22 19:21:12,573 ERROR ERROR:polyinterface.polyinterface:ERROR:polyinterface.polyinterface:--- Logging error ---
  • 2018-07-22 19:21:12,573 ERROR ERROR:polyinterface.polyinterface:ERROR:polyinterface.polyinterface:ERROR:polyinterface.polyinterface:--- Logging error ---
  • 2018-07-22 19:21:12,574 ERROR ERROR:polyinterface.polyinterface:ERROR:polyinterface.polyinterface:ERROR:polyinterface.polyinterface:ERROR:polyinterface.polyinterface:--- Logging error ---
  • 2018-07-22 19:21:12,574 ERROR ERROR:polyinterface.polyinterface:ERROR:polyinterface.polyinterface:ERROR:polyinterface.polyinterface:ERROR:polyinterface.polyinterface:ERROR:polyinterface.polyinterface:--- Logging error ---

Let me know if you want me to send the log package.

 

Link to comment
Share on other sites

1 minute ago, DaveStLou said:

I tried to update to the current version from 0.3.3 and I ran into a "pullRepo:undefined" error. So I uninstalled, deleted the AVRemote folder on the Pi and attempted to reinstall. After adding the server, it starts up but after a minute or two disconnects. When I look at the configuration it is empty which is different than I recall happening before. I remember adding my second Onkyo but I thought there were default, empty values already in the configuration file.

The AVRemote log ends with the following:

  • 2018-07-22 19:21:12,572 ERROR --- Logging error ---
  • 2018-07-22 19:21:12,572 ERROR ERROR:polyinterface.polyinterface:--- Logging error ---
  • 2018-07-22 19:21:12,573 ERROR ERROR:polyinterface.polyinterface:ERROR:polyinterface.polyinterface:--- Logging error ---
  • 2018-07-22 19:21:12,573 ERROR ERROR:polyinterface.polyinterface:ERROR:polyinterface.polyinterface:ERROR:polyinterface.polyinterface:--- Logging error ---
  • 2018-07-22 19:21:12,574 ERROR ERROR:polyinterface.polyinterface:ERROR:polyinterface.polyinterface:ERROR:polyinterface.polyinterface:ERROR:polyinterface.polyinterface:--- Logging error ---
  • 2018-07-22 19:21:12,574 ERROR ERROR:polyinterface.polyinterface:ERROR:polyinterface.polyinterface:ERROR:polyinterface.polyinterface:ERROR:polyinterface.polyinterface:ERROR:polyinterface.polyinterface:--- Logging error ---

Let me know if you want me to send the log package.

 

What versions of everything are you running? Do you know how to link polyinterface 2.0.28? pychromcast, unfortunately, causes this logger issue when it finds chromecasts on the network.

Link to comment
Share on other sites

1 hour ago, firstone said:

What versions of everything are you running? Do you know how to link polyinterface 2.0.28? pychromcast, unfortunately, causes this logger issue when it finds chromecasts on the network.

No, I don't know how to do that. Can you point me to instructions?

Link to comment
Share on other sites

11 minutes ago, DaveStLou said:

No, I don't know how to do that. Can you point me to instructions?

Here's how to install Polyinterface 2.0.28 and this will fix the logging error (complements of @xKing) :

mkdir -p ~/src
cd ~/src
git clone https://github.com/UniversalDevicesInc/polyglot-v2-python-interface.git
cd polyglot-v2-python-interface/
cp polyinterface/* ~/.local/lib/python3.5/site-packages/polyinterface/

Restart polyglot and AVRemote should work again.

Link to comment
Share on other sites

A better way is to do this, after you git clone per above:

cd ~/.polyglot/nodeservers/AVRemote
ln -s ~/src/polyglot-v2-python-interface/polyinterface polyinterface

This way any successive install will not overwrite polyinterface.

Link to comment
Share on other sites

On 7/21/2018 at 9:10 PM, beninsteon said:

FYI, I restarted the nodeserver and for some reason it's not initializing any devices other than "bedroom speakers" (online) and "ceiling speakers" (status), even though it finds all the devices:

nothing after 20:50:24...

I assume that's why there's no online reporting or status for the other devices.

Ben

So far I'm not having much success reproducing it. I believe it's a bug in pychromecast. Which doesn't mean I will not be able to fix it but I need to reproduce it. I have a couple of google minis - I'll hook one up tomorrow and pull the plug, hopefully this will get it into the same state.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.


  • Recently Browsing

    • No registered users viewing this page.
  • Forum Statistics

    • Total Topics
      36.5k
    • Total Posts
      367.6k
×
×
  • Create New...