[OBSOLETE] j64Harmony - Amazon Echo + Harmony Hub Integration

I did not realize there were multiple addresses for the IDE. If you open up the j64.Harmony.WebApi/Repository/SmartThingsConnection.cs module you can can the BaseUrl to point at the useast1 address that you have.

 public string BaseUrl = "https://graph.api.smartthings.com";

I will have to make that configurable in the next version so it can be more easily changed.

Also, you can always install the smart app/device types manually into your IDE if this does not work out. I added the code to automatically install them because it should have made it a little easier to get running.

@joe64 absolutely amazing app surprised its not generated more of a buzz on here. did hit a snag, i updated my favourite channels in the app and decided to clean up your sample devices by deleting them from the IDE before hitting sync again…that was a mistake as at this point it still thinks its installed as a child device so is attempting to update a non existent device rather than install again. I got around this by deleting everything from ST and restarting but i think is you do a getChildDevice lookup as part of the Sync then this wouldn’t happen. here’s the log. obviously my mistake, but i’m pretty sure its one some other people will make.

862421c1-3597-4e7d-ad53-100eafdf2a67  11:46:08 AM: error java.lang.IllegalArgumentException: identifier required @ line 131
862421c1-3597-4e7d-ad53-100eafdf2a67  11:46:08 AM: debug Updating device Sound
862421c1-3597-4e7d-ad53-100eafdf2a67  11:46:08 AM: debug getChildDevices(false), children=97

@joe64

scrub the above so the reinstall fixed it to a point but with the number of channels the channel creation hit the 20 sec limit, and now i am unable to sync the remainder as it thinks its already created.

5a859334-4ab3-491a-af8d-1e19d12c3d04  11:57:49 AM: error java.lang.IllegalArgumentException: identifier required @ line 131
5a859334-4ab3-491a-af8d-1e19d12c3d04  11:57:49 AM: debug Updating device Sound
5a859334-4ab3-491a-af8d-1e19d12c3d04  11:57:49 AM: debug getChildDevices(false), children=101
5a859334-4ab3-491a-af8d-1e19d12c3d04  11:56:41 AM: error java.util.concurrent.TimeoutException: Execution time exceeded 20 app execution seconds: 56323341775387 @ line 70
5a859334-4ab3-491a-af8d-1e19d12c3d04  11:56:40 AM: debug Adding device Community
5a859334-4ab3-491a-af8d-1e19d12c3d04  11:56:40 AM: debug Adding device CNN
5a859334-4ab3-491a-af8d-1e19d12c3d04  11:56:38 AM: debug Adding device The Box
5a859334-4ab3-491a-af8d-1e19d12c3d04  11:56:38 AM: debug Adding device Magic
5a859334-4ab3-491a-af8d-1e19d12c3d04  11:56:37 AM: debug Adding device Kerrang

you need to introduce a way to do the device creation in batches incase this limit is hit, because if the device creation fails your code will not allow the creation. BTW none of those devices it said it created in the log actually got created.

where do you store the list i manually input? is in in a localdb?

You must have quite a few channels if you are hitting that 20 second limit. Although it could just be that ST is running really slow.

The smart app has code in the installAllDevices function that will loop through the list of input devices and compare to what is already added into the IDE. If it finds that a device already exists it will just make sure the name is the same otherwise it will perform addChildDevice. So you “should” be able to delete one of the device type and then when you resync it will put back what is not there already. This logic works fine until ST starts having issues. I have seen scenarios where i delete a child device but if i call getChildDevices() it will report that the deleted device is still there. As near as I can tell ST has consistency problems in their database and sometimes it takes minutes/hours before it will sync back up. When ST was having major performance issues a month ago i would have to delete the smart app and recreate it all from scratch just so it would get a new id and be able to add my child devices again. I would be willing to bet that there are millions of orphaned records in the ST database because of those type of issues.

The list of devices you create via the j64 web app is stored in a file: j64.Harmony.WebApi/wwwroot/j64GatewayConfiguration.json. If you wanted to manually batch them in you could just copy that file off, reduce the list of channels to just what you want to add, and then hit that sync button. Then put back the full list once you are happy with what you have added out there.

thanks for getting back to me. I am up and running. Figured it out a bit after I posted. The app is very good but my amazon echo…not so much it’s extremely hit and miss what I can name the channels. All the BBC channels if you name them with BBC in the name even phonetically Alexa doesn’t do anything so renaming them to weird stuff just isn’t gonna work for me…wont pass the WAF test :frowning: will keep thinking on how to do this but it is an excellent App well done

Yeah, I have to get creative on the channel names also. I use names like “eleven oh two” for channel 1102 or sometimes the name of TV shows that I watch on that channel.

I think a better overall solution would be to write a custom skillset for the echo so you don’t interfere with the standard names that echo recognizes. It does not look terribly difficult to do that but it is just one more moving part that increases the complexity/fragility of the setup.

Well your gonna have to get more moving parts in there if you want to support multiple echo’s in the future :wink:

I attempted all of your suggestions - I started by removing everything and starting fresh. I tried: Modified Baseurl, manually installing the devices and smartapp, but I can’t get it to authorize the app. and therefore can’t move past it.

Is there somewhere else the URL needs to be changed?

I will try to create a new account later tonight. Maybe it will put me on that new IDE so i will be able to debug it.

@45Wheelgun, @joe64 I can confirm that is the only place it does need changed, Iam on the EU Shard and i changed that to graph-eu01-euwest1.api.smartthings.com

however as per http://docs.smartthings.com/en/latest/ref-docs/smartapp-ref.html?highlight=getapiserverurl

if you change the line to the below it will just work for everybody without needing to change it

public string BaseUrl = (getApiServerUrl())

@joe64
just regarding name convention, did some testing around names like BBC1 being Called “Bee Bee Sea One” which worked but you had to say the BBC with a noticeable pause between, but could not do anything with Channel Four & Channel Five etc… alexa would just beep and do nothing no matter how i phrased it.

I have howver renamed all my channels like the following

TV BBC One
TV BBC Two
TV Channel Four

etc…

Just putting the word TV in front just seems to allow the names to work well. so for me it keeps the WAF so she just needs to say “Alexa Turn On the TV BBC One”

FYI there are actually (at least) three IDE URLs. You might find some insight on the following threads:

The install routine for smart tiles has addressed this issue as well, and there might be some insight here:

Thanks for taking the time to look into this.

Ideas? Running ubuntu 14.04 and used this guide to install asp.net

root@HARMONY:/opt/j64.Harmony# ./j64Start
Running dnu restore for Xmpp
Running dnu restore for WebApi

System.InvalidOperationException: The current runtime target framework is not compatible with ‘j64.Harmony.WebApi’.
Current runtime target framework: 'DNX,Version=v4.5.1 (dnx451)'
Version: 1.0.0-rc1-16609
Type: Mono
Architecture: x64
OS Name: Linux
OS Version: ubuntu 14.04
Runtime Id: ubuntu.14.04-x64

Please make sure the runtime matches a framework specified in project.json
at Microsoft.Dnx.ApplicationHost.DefaultHost.GetEntryPoint (System.String applicationName) <0x401ecbb0 + 0x00137> in :0
at Microsoft.Dnx.ApplicationHost.Program.ExecuteMain (Microsoft.Dnx.ApplicationHost.DefaultHost host, System.String applicationName, System.String[] args) <0x401ec780 + 0x000d7> in :0
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7f5c284018a0 + 0x00029> in :0
at Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute (System.Reflection.Assembly assembly, System.String[] args, IServiceProvider serviceProvider) <0x401b8dc0 + 0x001b6> in :0
at Microsoft.Dnx.Host.Bootstrapper.RunAsync (System.Collections.Generic.List`1 args, IRuntimeEnvironment env, System.String appBase, System.Runtime.Versioning.FrameworkName targetFramework) <0x401b41c0 + 0x00463> in :0

Hello,

I am based in the UK. Should the install instructions work? It appears to send me the graph-api instead of graph-eu01 web page for authorisation. Is there any additional instructions for us Brits.

Best wishes.

Based on this message it does not appear to be running the correct framework. I have not tried this on ubuntu but here is one thing to check. First, see what the default framework is that you have installed by running dnvm list. This is an imac but it should be similar and I think the “Active” or default framework should be coreclr. If it is not you can use the “dnvm use -r xxx -a xxx -p” command to get it set to be the active framework. Be sure to use the -p option since that will keep it as the active framework across reboots.

Joes-iMac:~ joe$ dnvm list

Active Version              Runtime Architecture OperatingSystem Alias
------ -------              ------- ------------ --------------- -----
  *    1.0.0-rc1-update1    coreclr x64          darwin          default
       1.0.0-rc1-update1    mono                 linux/osx       

There was a post up above about this, I think it applies to your scenario. Give this a try and let us know. I need to make an enhancement so it will recognize the different IDE urls that are out there.

https://community.smartthings.com/t/j64harmony-amazon-echo-harmony-hub-integration/42473/63

dnvm install latest -r coreclr -arch x64

This worked

I finally got this to install after rebuilding my PC to a 64bit system to take advantage of more memory. Next step is configuring the app.

Congratulations on making this app,I just tried the mute and pause and play actions and it worked for me.Unfortunately,I don’t have an extra PC to keep this webapp running.As soon i shut my laptop everything stops.Are there any alternatives?

Raspberry pi. Maybe an option