allanak / SmartThings

My cobbled together junk for home automation
13 stars 39 forks source link

Zone 2 + Pandora #7

Open robross0606 opened 4 years ago

robross0606 commented 4 years ago

Been trying like made to figure out a way to automate turning on Zone 2 of my Onkyo receiver and switching to Pandora. I've tried with Harmony and Alexa and several other ways, but none of them seems to know how to toggle Pandora as a discrete command. Now I see some EISCP commands that look like they might work (i.e. "NSV") but I'll be damned if I can figure out what the YAML file means. Any ideas would be greatly appreciated!

jasongabler commented 4 years ago

There are two commands involved, at least that seems to be how it works. SLI changes the source. 2B is net. NSV changes music service. 04 = net is Pandora (0A is Spotify).

def msg = getEiscpMessage("SLI2B") def msg = getEiscpMessage("NSV040")

I had gotten really close, but could not figured out that I needed the trailing 0 on the service designation until I saw this blog post.

Yeah, the YAML file is a bit confusing, but remember that it's not meant to be human-readable. It's easier to look at form within Github than, say a straight text editor. Even better if you put it into a YAML-aware IDE. Even still, you have to spend time making heads or tails of the format that EISCP is trying to generate. There are hints, such as this formatting which I still have yet to learn how to decipher:

'NSV': {'service-id': u'ssiaaaa\u2026aaaabbbb\u2026bbbb'},

I'm sure this is the thing that says "It can be these chars and those but not those with these"... basically like some convoluted regex. Those \u2026 unicode chars are ellipses, but other than that, I'm still trying to figure this out.

Anyhow, you're welcome ;).

By the way, have you noticed that volume changes work (with some tweaking, at least with my Pioneer VSX LX503), but the device in the SmartThings UI just spins? I slide the volume slider, it makes the change on the receiver, but never seem to receive a satisfactory response from the cloud/hub. After a while it times out and the slider goes to 0. The receiver is fine though.... weird

allanak commented 4 years ago

Hey @robross0606 @jasongabler - feel free to openly discuss this here but I've moved everything to Home Assistant a few years ago and obviously haven't maintained this at all. I'm happy to take a pull request since it seems my repo still gets some attention once in a while, but this has been forked 40 times and I assume someone has built on my work since then. Cheers

jasongabler commented 4 years ago

@allanak , I've looked through every single one of the the forks and absolutely no one has done anything of consequence :D A few spelling corrections and code reformats here and there. Anyhow...

The most interesting part of your work is your deciphering of the highly over-engineered eISCP libraries in Python floating around Git. (If that is, in fact, where you learned to construct the ISCP messages in getEiscpMessage().) I had really tried to avoid wading through how miracle2k's Python code where takes Onkyo's commans definition tables, gronks them into YAML, and then reinterprets all that to produce binary commands to send to the receiver. My laziness has really paid off since finding your oh so simple Groovy code that gets it natively into a SmartThings device handler. Thanks for that, and I will do my best to pay it back with a pull request.

djarvis commented 8 months ago

@jasongabler Hey did you ever figure this out? I'm trying to do the same thing with a raw eiscp command like this. The eiscp-commands.yaml file doesn't make sense with the aaaa..aaaa bbbb.bbbb placements of username/password since there are multiple aaaa's and bbbb's in the string:

NSV: name: net-service description: NET Service(for Network Control Only) values: "ssiaaaa\u2026aaaabbbb\u2026bbbb": name: service-id description: "select Network Service directly\nss -> Network Serveice\n 00:Music\ \ Server (DLNA), 01:Favorite, 02:vTuner, 03:SiriusXM, 04:Pandora, 05:Rhapsody,\ \ 06:Last.fm,\n 07:Napster, 08:Slacker, 09:Mediafly, 0A:Spotify, 0B:AUPEO!,\ \ 0C:Radiko, 0D:e-onkyo,\n 0E:TuneIn Radio, 0F:mp3tunes, 10:Simfy, 11:Home\ \ Media, 12:Deezer, 13:iHeartRadio, 18:Airplay, 19:TIDAL, 1A:onkyo music,\ \ F0;USB/USB(Front), F1:USB(Rear)\ni-> Acount Info\n 0: No\n 1: Yes\n\"\ aaaa...aaaa\": User Name ( 128 Unicode letters [UTF-8 encoded] max )\n\"\ bbbb...bbbb\": Password ( 128 Unicode letters [UTF-8 encoded] max )" models: set1