blueman2 Posted September 27, 2015 Share Posted September 27, 2015 Excellent Barry!! I am traveling but look forward to getting your new version installed and tested when I return. Great news on the z-wave addition. You have done a fantastic job on documentation. Your background is really showing. Quote Link to comment
smileyw Posted September 30, 2015 Share Posted September 30, 2015 I have finally read this entire topic... I was using the original version and it was working great for both the Echo as well as my Harmony. For some reason I can't figure out, it completely stopped working. Nothing sees it anymore (It feels like a UPNP problem, but I am not 100% sure). In any case, I tried the newer BWS version .4.4, and that works, but now the Harmony doesn't work anymore. I can't seem to find any information out about it, or to see if there is anything I need to do in order to get the Harmony support to work. I know this is off topic, but I can't find anyplace else to ask this, so I thought I would ask here. Quote Link to comment
barrygordon Posted September 30, 2015 Share Posted September 30, 2015 There are two places to look. bwssystems.com and the Mi Casa Verde site/forum. The Hue emulator was originally developed for the Mi Casa Verde platform. The owner of BWS Systems is the developer of the current systems and I know he has been trying to clean up any issues with the Harmony systems. My focus has strictly been on the ISY994 and other systems I own. When I develop software and tools I develop for myself and then share. I am willing to expand any thing I develop to handle more cases. The biggest issue is having equipment to test with I have no Harmony Gear I have no Mi Casa Verde gear. I have no Philips HUE hub. I don't like giving out software, even for free, that I cannot properly test . I wrote the configuration system aimed strictly at ISY994 users. It reads all the configuration data from the ISY so it can provide a pretty clean typing-free experience. It handles non-ISY end points in a limited manner. I use that capability to deal with an Autelis pool control and my Home Theater. To do so requires one to write their own end point. The HUE bridge and hence its emulators, were designed to control lights. On, Off, Dim. With the ISY994 as the endpoint devices can be turned on, off and set to specific brightness level. Scenes can be turned on or off, Scene brightness can not be controlled and that is an ISY issue. You can have different named scenes controlling different brightness of coordinated devices, or as I do in my home controlling fan motors to their 4 possible settings of Off, Low, Medium, and High. The phrases the Echo understands are quite limited unless you write your own "Skill" to control the Echo, and that introduces, IMHO, an extra layer of Cumbersome speech. The ones I use start with Alexa, Turn On ..., Alexa, Turn Off ..., Alexa, Shut ... Alexa, Set Brightness to ... I am getting way over 90% recognition and my home is not ideal in that it has a high reverb factor; lots of hard surfaces, Big spaces, and Little natural audio absorption. Quote Link to comment
smileyw Posted September 30, 2015 Share Posted September 30, 2015 There are two places to look. bwssystems.com and the Mi Casa Verde site/forum. The Hue emulator was originally developed for the Mi Casa Verde platform. The owner of BWS Systems is the developer of the current systems and I know he has been trying to clean up any issues with the Harmony systems. My focus has strictly been on the ISY994 and other systems I own. When I develop software and tools I develop for myself and then share. I am willing to expand any thing I develop to handle more cases. The biggest issue is having equipment to test with I have no Harmony Gear I have no Mi Casa Verde gear. I have no Philips HUE hub. I don't like giving out software, even for free, that I cannot properly test . I wrote the configuration system aimed strictly at ISY994 users. It reads all the configuration data from the ISY so it can provide a pretty clean typing-free experience. It handles non-ISY end points in a limited manner. I use that capability to deal with an Autelis pool control and my Home Theater. To do so requires one to write their own end point. The HUE bridge and hence its emulators, were designed to control lights. On, Off, Dim. With the ISY994 as the endpoint devices can be turned on, off and set to specific brightness level. Scenes can be turned on or off, Scene brightness can not be controlled and that is an ISY issue. You can have different named scenes controlling different brightness of coordinated devices, or as I do in my home controlling fan motors to their 4 possible settings of Off, Low, Medium, and High. The phrases the Echo understands are quite limited unless you write your own "Skill" to control the Echo, and that introduces, IMHO, an extra layer of Cumbersome speech. The ones I use start with Alexa, Turn On ..., Alexa, Turn Off ..., Alexa, Shut ... Alexa, Set Brightness to ... I am getting way over 90% recognition and my home is not ideal in that it has a high reverb factor; lots of hard surfaces, Big spaces, and Little natural audio absorption. I agree. The skill is a direction I would rather not go. I am thinking I may use both. For the 10 or so items I use all the time, I will use the BWS emulator, and for the more obscure stuff I will use the skill (once one is working that hopefully does not require the UD service which I do not currently use. I will hit up the Mi Casa forums and see if I can work this out there. Thanks for pointing me in the right direction. Now back to your regularly scheduled discussion that is ISY specific. Quote Link to comment
jnaiser60 Posted September 30, 2015 Share Posted September 30, 2015 I have two ISY-Elk implementations. One at my office and one at my home. Both, highly automated. Home also includes homeseer as well as a to many toys to mention. I have been doing this stuff since the eighties and have beta tested at some point for most everybody. Yes I have Xbox stuff integrated thru Homeseer. (sucks) and yes I output text to speech thru whole house audio. The whole reason I use Homeseer on a dedicated PC is for Voice I/O. Nothing else.... Recently, I also rented an apartment in town, so I thought it would be a good idea to automate that as well. Having a couple Echos, already, I went ahead and grabbed a Insteon Hub. Holy crapoly, that small installation made me smile. That hubs not very capable of much, but its so simple. And the ability (finely) to say: Alexa: turn the living room lamp on. (once) and it happens...... I struggled (for years) with PZM mics and mixers, and never ever, could I get this level of accuracy. Yes I was a tester for Butler in a box, and also HAL. They were a joke compared to this. Siri is a joke compared to this.... I spent some time on the phone today, with the people at smart home, to see if there was a way to export my devices from ISY, homeseer or Elk. I would do it. Seriously, I can see ten echos in my house. They were clueless as always..... And that little toy, priced at 79 bucks, works amazingly well with the Echo. Just don't want another controller to maintain. Please Michael.... get this thing going! Jerry Quote Link to comment
barrygordon Posted September 30, 2015 Share Posted September 30, 2015 With the HUE emulator hub You can do just about the same things as with Insteon HUB, but using the ISY994. I even talk to Homeseer through that Emulator but only for very limited things as Homeseer does very little any more in my home. It is all detailed in this somewhat lengthy thread. Quote Link to comment
scimanic1 Posted October 1, 2015 Share Posted October 1, 2015 Barry, Thanks for all your efforts in developing this solution. Unfortunately, probably due to my lack of understanding, I am unable to get your AWS_Config program to work. AWS_Config is detecting my ISY and two emulators running but errors with "Run-time error '13': Type mismatch" after 40 devices are listed in the "Start of ISY Device Setup" section of the AWS_Alexa file. Quote Link to comment
btreinders Posted October 1, 2015 Share Posted October 1, 2015 Barry, Thanks for all your efforts in developing this solution. Unfortunately, probably due to my lack of understanding, I am unable to get your AWS_Config program to work. AWS_Config is detecting my ISY and two emulators running but errors with "Run-time error '13': Type mismatch" after 40 devices are listed in the "Start of ISY Device Setup" section of the AWS_Alexa file. I get that same error but if I keep trying it eventually comes up and works. Can take up to ten tries. Quote Link to comment
barrygordon Posted October 1, 2015 Share Posted October 1, 2015 If you do the following I will be glad to look at the problem: Make sure the ini file has "Debug=All ISY DVC" in the system section, without the quotes. Run the system until it fails. Send me the following: The log file AWS_Alexa.log; The ini file, A statement as to the version of AWS_Config that is running (e.g. 2.0.19); If possible a screen capture of the screen when the error occurs. Information about the version of the HUE Emulator you are using. Exactly what you were doing when it failed. e.g. clicked on something after . . . I thought I had cleaned all the type mismatch errors, but I might have missed one. The program is a little sensitive to how your ISY is setup and the logfile plus the ini file should help me see where the problem is. Email the information to me at barry@the-gordons.net. If it works after repeated tries that generally indicates some sort of networking problem. When it fails it should fail consistently if you are not changing anything. Quote Link to comment
Guitartexan Posted October 1, 2015 Share Posted October 1, 2015 I simply must add my praise to what others have said here Barry. You are one of the most unselfish and uber experienced engineers to grace this forum. I and many others tip our hats to you and thank you for your gracious kindness. GT Quote Link to comment
barrygordon Posted October 1, 2015 Share Posted October 1, 2015 Thanks for the kind words. I do what I do because I really enjoy doing it. I like building things, any sort of things and solving puzzles. I sometimes think I subconsciously introduce minor errors so I can hunt for them later. Quote Link to comment
barrygordon Posted October 1, 2015 Share Posted October 1, 2015 Smileyw, I just received an email from the forum regarding a problem you are having with the configuration system. The post referred to in the email does not seem to be here. I sent you a private message as a reply. When sending me requests for help with the configuration system Please try and send 4 things: 1 - The version number of the AWS_Application and the version number of the HUE Emulator 2 - The log file AWS_Alexa.log from the same directory as the program. 3 - The ini file AWS-Config.ini from the same directory as the program. 4 - A screen capture of the screen when it fails with any error message moved to not cover the information. These can be 4 separate attachments or zipped into a single archive. Quote Link to comment
barrygordon Posted October 2, 2015 Share Posted October 2, 2015 I just posted a new version of my Configuration program. This should fix the "Error 13 Type Mismatch". See the changed ini file which is in the package (CAB file). When sending a log file for me to look at because of a problem please ensure that the program was run with an ini file that had the line "Debug = All ISY DVC" (without the quotes). Also include a copy of the ini file you used when you ran the program instance that caused the problem. There is a change in the ini file. Your ini file should have the line that says "Zwave = 4" changed to "Irrigation = 4" (Without the quotes). With regard to the ini file I suggest the following: [Note, to comment out a line place a single quote in the first position] Unless you have your scenes in folders and you only wish to process certain folders remove the line "Scene Filters = ..." otherwise change the value to the names of the folders you wish to process The default value for "Show Scene Folders" is false so the line can be removed, especially if your scenes are not in folders. The "Location" is only needed if you want to specify the Location of the ISY and not have a uPnP search take place to find it\ If you are not using custom endpoints (endpoints other than the ISY) then the [Custom Endpoints] section can be removed and any lines in that section The Debug line is not necessary unless I request it to find an error. If I ask you to provide a log file, then the debug line should be "Debug = All ISY DVC" (without quotes) In the [Device Types] section set the name of type 4 to "Irrigation". The line should read "Irrigation = 4" (without the quotes) and not "Zwave = 4" (without quotes). PLEASE read the documentation on the ini file in the Word doc. I would like to hear back from any who were experiencing the Type 13 error, type mismatch to know if this new version resolved the issue. Quote Link to comment
philtor Posted October 4, 2015 Share Posted October 4, 2015 (edited) Has anyone tried the new restful-harmony control client https://github.com/bwssytems/restful-harmony? I have it up and running along with ha-bridge and I can use GET to see the config and device list, but I can't seem to figure out how to properly send the PUT commands to control my Harmony Hub devices. I would really like to get this working with my Echo using AWS-Config. Edited October 4, 2015 by philtor Quote Link to comment
barrygordon Posted October 4, 2015 Share Posted October 4, 2015 (edited) While I know a great deal about the ISY I know nothing about the Harmony Hub. I would be more than willing to modify the AWS_Config to be Harmony savvy but would need a Harmony unit to test with. Can someone point me to information on the Harmony unit? I am fairly familiar with the Hue Emulator but will need to look at what BWS systems has done for the Harmony unit. I just took a look at what BSW published on the GIT. It seems that the REST server for the Harmony does all that is needed or am I missing something not being familiar with the Harmony Architecture. As an alternative I would need a Userid and Password to an active account at harmonyhub.com, and some one willing to work with me that has a Harmony Hub. I can write a quick Harmony-Emulator to show me what is sent to the Harmony Hub by the echo. Also helpful would be if whoever has a harmony hub could use Wireshark or Etherdetect to capture things that might be being sent to the hub so I have an idea what is correct. As I said I have no knowledge pertaining to the Harmony Hub so It will be a bit of learning in the beginning. Edited October 4, 2015 by barrygordon Quote Link to comment
Eric2XU Posted October 5, 2015 Share Posted October 5, 2015 (edited) I debated posting this as it may bring a tidal wave of PM's and whatnot that I don't have much time for (my second child is being born in a few days). However after more thought I figured I could at least give people some direction. I have finished writing code that pulls together Alexa, Hue Emulator 0.2.1, Logitech Harmony, Google Nest, and RainMachine. I can do things like: “Alexa turn on TV” “Alexa turn on Playstation” “Alexa set Thermostat 74” “Alexa turn on Sprinkler 2” It's the first C# app I have ever wrote, my code is sloppy, has hard coded values for IP, Username, and Passwords, not very oop, requires IIS/.Net4.5, and in no shape to share. But I will post as-is below as I thought I would let people know the basics of how I did it in case anyone else would like to make a more refined version. Everything gets setup in the Hue Bridge as a Light. All on and off urls point back at my custom Microsoft C# .NET ASPX web site. It's a single page takes in two URL parms (Operation and Intensity[Optional]) Thermostat uses Intensity Percentage to get back a numerical value, if its outside of 65 - 81 I hard code 74 to make sure things dont get out of hand Website has "If" sections for each Operation type, examples of Operations are like "Light-Kitchen-On" or "Nest" or "RainMahine-Zone2-On" In each If section I do whatever option is needed, for ISY I simply call the REST API accordingly for Harmony I actually call a prebuilt c++ application that takes command line parms (http://sourceforge.net/projects/harmonyhubcontrol/files/)Note: I really tried hard to use other 3rd party c# code to do it directly within the web app but I failed alot due to the messed up XMPP protocol Harmony uses and finally just had the website execute this exe which works flawlessly (and still quick) for the Nest I call their REST API accordingly for RainMachine again I call their REST API Accordingly Most of my web calls use the WebRequest or WebClient .NET classes Notes about Nest Nest's API's are great, you do have to go and sign up for a web developer account. Then create a program (put anything it wont really matter) Once you have a program you will get a client ID and Client Secret Go here in a browser and get a PIN https://home.nest.com/login/oauth2?client_id=<clientID>&state=Balls Then go here with your client ID, Client secret, and PIN (note: PIN is a one time use) https://api.home.nest.com/oauth2/access_token?code=<PIN>&client_id=<clientid>&client_secret=<client_secret>&grant_type=authorization_code You should get back a session key "{\"access_token\":\"c.fyCVHgmvY1bCXchYdfjhfjghfjhgfjgdfkhfkghfkghfFGRgrtR3rChnjrSEZmc\",\"expires_in\":315360000}" This session key can be hardcoded into the code below as its good for 10 years then you never have to worry about coding a logon to Nest (quicker too) Harmony Notes: Used this code to compile an exe: (http://sourceforge.net/projects/harmonyhubcontrol/files/) Simply call the exe with switches can use exe tool to discover commands, devices, activities RainMachine Notes: By far the best documented API, was quick and easy, you shouldn't have any problems with this one CODE: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.IO; using System.Net; using System.Web.Script.Serialization; using System.Collections.Specialized; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Net.Security; namespace ISY_Pokey { public partial class _Default : System.Web.UI.Page { class RainMachine { public string Password { get; set; } public string access_token { get; set; } public string checksum { get; set; } public string expiration { get; set; } public string statusCode { get; set; } } public void ProcessURI(string URI) { try { WebClient webClient = new WebClient(); webClient.Credentials = new NetworkCredential("ISYUsername", "ISYPassword"); Stream stream = webClient.OpenRead(URI); } catch (WebException ex) { if (ex.Response is HttpWebResponse) { switch (((HttpWebResponse)ex.Response).StatusCode) { case HttpStatusCode.NotFound: break; default: throw ex; } } } } protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["operation"] != null) { int intLightLevel; string LightLevel = "255"; if (Request.QueryString["LightLevel"] != null) { if (int.TryParse(Request.QueryString["LightLevel"], out intLightLevel)) { LightLevel =intLightLevel.ToString(); } } int intNestLevel; string NestLevel = "76"; if (Request.QueryString["NestLevel"] != null) { if (int.TryParse(Request.QueryString["NestLevel"], out intNestLevel)) { if (intNestLevel > 68 && intNestLevel < 81) { NestLevel = intNestLevel.ToString(); } } } if (Request.QueryString["operation"] == "Light-On-LivingRoomLED") { ltNotify.Text = Request.QueryString["operation"]; ProcessURI("http://192.168.1.10/rest/nodes/36981/cmd/DON/"); } if (Request.QueryString["operation"] == "Light-Off-LivingRoomLED") { ltNotify.Text = Request.QueryString["operation"]; ProcessURI("http://192.168.1.10/rest/nodes/36981/cmd/DOF/"); } if (Request.QueryString["operation"] == "Light-On-LivingRoom") { ltNotify.Text = Request.QueryString["operation"]; ProcessURI("http://192.168.1.10/rest/nodes/2F%20CF%20A6%201/cmd/DON/" + LightLevel); } if (Request.QueryString["operation"] == "Light-Off-LivingRoom") { ltNotify.Text = Request.QueryString["operation"]; ProcessURI("http://192.168.1.10/rest/nodes/2F%20CF%20A6%201/cmd/DOF/"); } if (Request.QueryString["operation"] == "Light-On-Breakfast") { ltNotify.Text = Request.QueryString["operation"]; ProcessURI("http://192.168.1.10/rest/nodes/8052/cmd/DON/" + LightLevel); } if (Request.QueryString["operation"] == "Light-Off-Breakfast") { ltNotify.Text = Request.QueryString["operation"]; ProcessURI("http://192.168.1.10/rest/nodes/8052/cmd/DOF/" ); } if (Request.QueryString["operation"] == "Light-On-Kitchen") { ltNotify.Text = Request.QueryString["operation"]; //Breakfast ProcessURI("http://192.168.1.10/rest/nodes/8052/cmd/DON/"); //Kitchen Main ProcessURI("http://192.168.1.10/rest/nodes/21177/cmd/DON/"); //Kitchen Under Cab ProcessURI("http://192.168.1.10/rest/nodes/19847/cmd/DON/"); //Kitchen Island ProcessURI("http://192.168.1.10/rest/nodes/2B%20FD%2080%201/cmd/DON/"); } if (Request.QueryString["operation"] == "Light-Off-Kitchen") { ltNotify.Text = Request.QueryString["operation"]; //Breakfast ProcessURI("http://192.168.1.10/rest/nodes/8052/cmd/DOF/"); //Kitchen Main ProcessURI("http://192.168.1.10/rest/nodes/21177/cmd/DOF/"); //Kitchen Under Cab ProcessURI("http://192.168.1.10/rest/nodes/19847/cmd/DOF/"); //Kitchen Island ProcessURI("http://192.168.1.10/rest/nodes/2B%20FD%2080%201/cmd/DOF/"); } if (Request.QueryString["operation"] == "Light-On-Laundry") { ltNotify.Text = Request.QueryString["operation"]; ProcessURI("http://192.168.1.10/rest/nodes/47290/cmd/DON/"); } if (Request.QueryString["operation"] == "Light-Off-Laundry") { ltNotify.Text = Request.QueryString["operation"]; ProcessURI("http://192.168.1.10/rest/nodes/47290/cmd/DOF/"); } if (Request.QueryString["operation"] == "Light-On-Hallway") { ltNotify.Text = Request.QueryString["operation"]; ProcessURI("http://192.168.1.10/rest/nodes/2F%20CB%2050%201/cmd/DON/" + LightLevel); } if (Request.QueryString["operation"] == "Light-Off-Hallway") { ltNotify.Text = Request.QueryString["operation"]; ProcessURI("http://192.168.1.10/rest/nodes/2F%20CB%2050%201/cmd/DOF/"); } if (Request.QueryString["operation"] == "Light-On-Patio") { ltNotify.Text = Request.QueryString["operation"]; ProcessURI("http://192.168.1.10/rest/nodes/48068/cmd/DON/" + LightLevel); } if (Request.QueryString["operation"] == "Light-Off-Patio") { ltNotify.Text = Request.QueryString["operation"]; ProcessURI("http://192.168.1.10/rest/nodes/48068/cmd/DOF/"); } if (Request.QueryString["operation"] == "Light-On-Foyer") { ltNotify.Text = Request.QueryString["operation"]; ProcessURI("http://192.168.1.10/rest/nodes/4669/cmd/DON/" + LightLevel); } if (Request.QueryString["operation"] == "Light-Off-Foyer") { ltNotify.Text = Request.QueryString["operation"]; ProcessURI("http://192.168.1.10/rest/nodes/4669/cmd/DOF/"); } if (Request.QueryString["operation"] == "Shit-On") { ltNotify.Text = Request.QueryString["operation"]; //TVLED ProcessURI("http://192.168.1.10/rest/nodes/36981/cmd/DON/"); //Breakfast ProcessURI("http://192.168.1.10/rest/nodes/8052/cmd/DON/"); //Kitchen Main ProcessURI("http://192.168.1.10/rest/nodes/21177/cmd/DON/"); //Kitchen Under Cab ProcessURI("http://192.168.1.10/rest/nodes/19847/cmd/DON/"); //Kitchen Island ProcessURI("http://192.168.1.10/rest/nodes/2B%20FD%2080%201/cmd/DON/"); //LivingRoom ProcessURI("http://192.168.1.10/rest/nodes/2F%20CF%20A6%201/cmd/DON/"); } if (Request.QueryString["operation"] == "Shit-Off") { ltNotify.Text = Request.QueryString["operation"]; //TVLED ProcessURI("http://192.168.1.10/rest/nodes/36981/cmd/DOF/"); //LivingRoom ProcessURI("http://192.168.1.10/rest/nodes/2F%20CF%20A6%201/cmd/DOF/"); //Breakfast ProcessURI("http://192.168.1.10/rest/nodes/8052/cmd/DOF/"); //Kitchen Main ProcessURI("http://192.168.1.10/rest/nodes/21177/cmd/DOF/"); //Kitchen Under Cab ProcessURI("http://192.168.1.10/rest/nodes/19847/cmd/DOF/"); //Kitchen Island ProcessURI("http://192.168.1.10/rest/nodes/2B%20FD%2080%201/cmd/DOF/"); //Laundry ProcessURI("http://192.168.1.10/rest/nodes/47290/cmd/DOF/"); //Downstairs Hallway ProcessURI("http://192.168.1.10/rest/nodes/2F%20CB%2050%201/cmd/DOF/"); //Patio ProcessURI("http://192.168.1.10/rest/nodes/48068/cmd/DOF/"); //Foyer ProcessURI("http://192.168.1.10/rest/nodes/4669/cmd/DOF/"); } if (Request.QueryString["operation"] == "Harmony-TV-On") { ltNotify.Text = Request.QueryString["operation"]; //Turn on TV var p = new System.Diagnostics.Process(); p.StartInfo.FileName = "D:\\websites\\ISY_Pokey\\Tools\\HarmonyHubControl.exe"; p.StartInfo.Arguments = String.Format("logitechlogon logitechpassword 192.168.1.11 start_activity 15941161"); p.Start(); } if (Request.QueryString["operation"] == "Harmony-TV-OFF") { ltNotify.Text = Request.QueryString["operation"]; //Turn off TV var p = new System.Diagnostics.Process(); p.StartInfo.FileName = "D:\\websites\\ISY_Pokey\\Tools\\HarmonyHubControl.exe"; p.StartInfo.Arguments = String.Format("logitechlogon logitechpassword 192.168.1.11 start_activity -1"); p.Start(); } if (Request.QueryString["operation"] == "Harmony-Playstation-On") { ltNotify.Text = Request.QueryString["operation"]; //Turn on Playstation var p = new System.Diagnostics.Process(); p.StartInfo.FileName = "D:\\websites\\ISY_Pokey\\Tools\\HarmonyHubControl.exe"; p.StartInfo.Arguments = String.Format("logitechlogon logitechpassword 192.168.1.11 start_activity 15491165"); p.Start(); } if (Request.QueryString["operation"] == "Harmony-Playstation-OFF") { ltNotify.Text = Request.QueryString["operation"]; //Turn off Playstation var p = new System.Diagnostics.Process(); p.StartInfo.FileName = "D:\\websites\\ISY_Pokey\\Tools\\HarmonyHubControl.exe"; p.StartInfo.Arguments = String.Format("logitechlogon logitechpassword 192.168.1.11 start_activity -1"); p.Start(); } if (Request.QueryString["operation"] == "Harmony-AppleTV-On") { ltNotify.Text = Request.QueryString["operation"]; //Turn on AppleTV var p = new System.Diagnostics.Process(); p.StartInfo.FileName = "D:\\websites\\ISY_Pokey\\Tools\\HarmonyHubControl.exe"; p.StartInfo.Arguments = String.Format("logitechlogon logitechpassword 192.168.1.11 start_activity 15941146"); p.Start(); } if (Request.QueryString["operation"] == "Harmony-AppleTV-OFF") { ltNotify.Text = Request.QueryString["operation"]; //Turn off AppleTV var p = new System.Diagnostics.Process(); p.StartInfo.FileName = "D:\\websites\\ISY_Pokey\\Tools\\HarmonyHubControl.exe"; p.StartInfo.Arguments = String.Format("logitechlogon logitechpassword 192.168.1.11 start_activity -1"); p.Start(); } if (Request.QueryString["operation"] == "Nest") { ltNotify.Text = Request.QueryString["operation"]; PutObject("https://developer-api.nest.com/devices/thermostats/rUhPyxoY8fRMSEGr_d2q94RJ8Vs75QJ6/target_temperature_f?auth=<NestAPIAuthKey>", NestLevel); } if (Request.QueryString["operation"] == "Sprinkler-One-On") { ltNotify.Text = Request.QueryString["operation"]; string URI_Auth = "https://192.168.1.13/api/4/auth/login"; string PayLoad_Auth = "{\"pwd\":\"RainMachinePWD\",\"remember\": 1}"; string Content_Auth = HTTPPostJSONString(URI_Auth, PayLoad_Auth, 1); var json_serializer_Auth = new JavaScriptSerializer(); RainMachine RainMachine = json_serializer_Auth.Deserialize<RainMachine>(Content_Auth); Console.WriteLine(RainMachine.access_token); string URI_WaterZone_1 = "https://192.168.1.13/api/4/zone/1/start?access_token=" + RainMachine.access_token; string PayLoad_WaterZone_1 = "{\"time\":600}"; string Content_WaterZone_1 = HTTPPostJSONString(URI_WaterZone_1, PayLoad_WaterZone_1, 1); Console.WriteLine(Content_WaterZone_1); } if (Request.QueryString["operation"] == "Sprinkler-One-Off") { ltNotify.Text = Request.QueryString["operation"]; string URI_Auth = "https://192.168.1.13/api/4/auth/login"; string PayLoad_Auth = "{\"pwd\":\"RainMachinePWD\",\"remember\": 1}"; string Content_Auth = HTTPPostJSONString(URI_Auth, PayLoad_Auth, 1); var json_serializer_Auth = new JavaScriptSerializer(); RainMachine RainMachine = json_serializer_Auth.Deserialize<RainMachine>(Content_Auth); Console.WriteLine(RainMachine.access_token); string URI_WaterZone_1 = "https://192.168.1.13/api/4/zone/1/stop?access_token=" + RainMachine.access_token; string PayLoad_WaterZone_1 = "{\"time\":\"10\"}"; string Content_WaterZone_1 = HTTPPostJSONString(URI_WaterZone_1, PayLoad_WaterZone_1, 1); Console.WriteLine(Content_WaterZone_1); } if (Request.QueryString["operation"] == "Sprinkler-Two-On") { ltNotify.Text = Request.QueryString["operation"]; string URI_Auth = "https://192.168.1.13/api/4/auth/login"; string PayLoad_Auth = "{\"pwd\":\"RainMachinePWD\",\"remember\": 1}"; string Content_Auth = HTTPPostJSONString(URI_Auth, PayLoad_Auth, 1); var json_serializer_Auth = new JavaScriptSerializer(); RainMachine RainMachine = json_serializer_Auth.Deserialize<RainMachine>(Content_Auth); Console.WriteLine(RainMachine.access_token); string URI_WaterZone_2 = "https://192.168.1.13/api/4/zone/2/start?access_token=" + RainMachine.access_token; string PayLoad_WaterZone_2 = "{\"time\":600}"; string Content_WaterZone_2 = HTTPPostJSONString(URI_WaterZone_2, PayLoad_WaterZone_2, 1); ltNotify.Text = ltNotify.Text + "<br>" + Content_WaterZone_2; } if (Request.QueryString["operation"] == "Sprinkler-Two-Off") { ltNotify.Text = Request.QueryString["operation"]; string URI_Auth = "https://192.168.1.13/api/4/auth/login"; string PayLoad_Auth = "{\"pwd\":\"RainMachinePWD\",\"remember\": 1}"; string Content_Auth = HTTPPostJSONString(URI_Auth, PayLoad_Auth, 1); var json_serializer_Auth = new JavaScriptSerializer(); RainMachine RainMachine = json_serializer_Auth.Deserialize<RainMachine>(Content_Auth); Console.WriteLine(RainMachine.access_token); string URI_WaterZone_2 = "https://192.168.1.13/api/4/zone/2/stop?access_token=" + RainMachine.access_token; string PayLoad_WaterZone_2 = "{\"time\":\"10\"}"; string Content_WaterZone_2 = HTTPPostJSONString(URI_WaterZone_2, PayLoad_WaterZone_2, 1); Console.WriteLine(Content_WaterZone_2); } if (Request.QueryString["operation"] == "Sprinkler-Three-On") { ltNotify.Text = Request.QueryString["operation"]; string URI_Auth = "https://192.168.1.13/api/4/auth/login"; string PayLoad_Auth = "{\"pwd\":\"RainMachinePWD\",\"remember\": 1}"; string Content_Auth = HTTPPostJSONString(URI_Auth, PayLoad_Auth, 1); var json_serializer_Auth = new JavaScriptSerializer(); RainMachine RainMachine = json_serializer_Auth.Deserialize<RainMachine>(Content_Auth); Console.WriteLine(RainMachine.access_token); string URI_WaterZone_3 = "https://192.168.1.13/api/4/zone/3/start?access_token=" + RainMachine.access_token; string PayLoad_WaterZone_3 = "{\"time\":600}"; string Content_WaterZone_3 = HTTPPostJSONString(URI_WaterZone_3, PayLoad_WaterZone_3, 1); Console.WriteLine(Content_WaterZone_3); } if (Request.QueryString["operation"] == "Sprinkler-Three-Off") { ltNotify.Text = Request.QueryString["operation"]; string URI_Auth = "https://192.168.1.13/api/4/auth/login"; string PayLoad_Auth = "{\"pwd\":\"RainMachinePWD\",\"remember\": 1}"; string Content_Auth = HTTPPostJSONString(URI_Auth, PayLoad_Auth, 1); var json_serializer_Auth = new JavaScriptSerializer(); RainMachine RainMachine = json_serializer_Auth.Deserialize<RainMachine>(Content_Auth); Console.WriteLine(RainMachine.access_token); string URI_WaterZone_3 = "https://192.168.1.13/api/4/zone/3/stop?access_token=" + RainMachine.access_token; string PayLoad_WaterZone_3 = "{\"time\":\"10\"}"; string Content_WaterZone_3 = HTTPPostJSONString(URI_WaterZone_3, PayLoad_WaterZone_3, 1); Console.WriteLine(Content_WaterZone_3); } } else { ltNotify.Text = "<br><br><strong>Things that can be called</strong><hr><br>Light-On-LivingRoomLED<br>Light-Off-LivingRoomLED<br>Light-On-LivingRoom<br>Light-Off-LivingRoom<br>Light-On-Breakfast<br>Light-Off-Breakfast<br>Light-On-Kitchen<br>Light-Off-Kitchen<br>Light-On-Laundry<br>Light-Off-Laundry<br>Light-On-Hallway<br>Light-Off-Hallway<br>Light-On-Patio<br>Light-Off-Patio<br>Light-On-Foryer<br>Light-Off-Foryer<br>Other Stuff I am too lazy to put in here"; } } public void PutObject(string postUrl, string payload) { var request = (HttpWebRequest)WebRequest.Create(postUrl); request.Method = "PUT"; request.ContentType = "application/json"; if (payload != null) { Stream dataStream = request.GetRequestStream(); // Invoke GetBytes method. // ... You can store this array as a field! byte[] array = Encoding.ASCII.GetBytes(payload); // Loop through contents of the array. foreach (byte element in array) { Console.WriteLine("{0} = {1}", element, (char)element); } dataStream.Write(array, 0, array.Length); dataStream.Close(); } HttpWebResponse response = (HttpWebResponse)request.GetResponse(); string returnString = response.StatusCode.ToString(); } public static string HTTPPostJSONString(string URI, string payload, int DisableSSL) { if (DisableSSL == 1) { ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(delegate { return true; }); } var http = (HttpWebRequest)WebRequest.Create(new Uri(URI)); http.Accept = "application/json"; http.ContentType = "application/json"; http.Method = "POST"; UTF8Encoding encoding = new UTF8Encoding(); Byte[] bytes = encoding.GetBytes(payload); Stream newStream = http.GetRequestStream(); newStream.Write(bytes, 0, bytes.Length); newStream.Close(); var response = http.GetResponse(); var stream = response.GetResponseStream(); var sr = new StreamReader(stream); var content = sr.ReadToEnd(); return content; } public static string HTTPGetString(string URI, int DisableSSL) { if (DisableSSL == 1) { ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(delegate { return true; }); } WebClient clnt = new WebClient(); string strResponse = clnt.DownloadString(URI); return strResponse; } } } Edited October 5, 2015 by jay5 Quote Link to comment
blueman2 Posted October 5, 2015 Share Posted October 5, 2015 (edited) Jay5, First, congratulations with the new addition to your family!!! Let us know how it goes. Get some sleep now. You will need it. Second, thanks SO much for sharing. I had no idea that Nest had an open API to access. This information alone is very valuable to me. Thanks for adding your work to the community! Blueman2 Edited October 6, 2015 by blueman2 Quote Link to comment
blueman2 Posted October 6, 2015 Share Posted October 6, 2015 (edited) OK, I sort of have my Insteon Thermostat working with the Echo. I manually put this into the command for my Thermostat-Main device: /rest/nodes/<thermostat-device-ID>1/cmd/CLISPC/${intensity.percent} It works, setting my AC to whatever temperature I give to Alexa by saying "Alexa, set Thermostat to 74". However, the ISY divides the number you give it by 2 because every digit is 1/2 of a degree. So if I say "Alexa, set Thermostat to 74" it will set the thermostat to 37. As a work around, I can change the command line to write the ${intensity.percent} to a State Variable in the ISY. I then use a program to multiply this by 2, and using the 5.0 ISY firmware write the variable to the thermostat I am not on 5.0 yet so cannot confirm this will work but it should assuming V5 allows writing variables to a device. (??) (edit: corrected to multiply vs divide per LeeG message below) Edited October 6, 2015 by blueman2 Quote Link to comment
tianlung4028 Posted October 6, 2015 Share Posted October 6, 2015 Hey guys.. I'm having some difficulty with the mapper. I've followed the instructions down to the letter but after I've found all my devices and renamed them and click Save I get an error saying that access is denied. I've tried installing the mapper on two separate machines (currently running Windows 10) but get the same error. I've also tried disabling windows firewall and antivirus settings. Also, my router is not configured for AP isolation. Any ideas? Thanks. Quote Link to comment
LeeG Posted October 6, 2015 Share Posted October 6, 2015 Cannot help with 5.x questions but it is multiply by 2, not divide by 2. I then use a program to divide this by 2, Quote Link to comment
barrygordon Posted October 6, 2015 Share Posted October 6, 2015 (edited) Just looking at the error suggests that you should be at administrator level. Try running the mapper program as admin (right click the exe and select run as administrator). No program should put operational data into the system32 directory but rather into a directory related to itself or to the user. I have written a different program that works with the newer version of the Hue Emulator as developed by BWS Systems. You can find a lot of information regarding the BWS Hue Emulator and my configuration program (AWS_CONFIG) in this thread Edited October 6, 2015 by barrygordon Quote Link to comment
barrygordon Posted October 6, 2015 Share Posted October 6, 2015 I have sent a request to BWS the Author of the emulator to see if he will make a change, ideally to allow math on the value spoken, or allow for ${intensity.temperature} which will send the ISY 2 times the value spoken. Quote Link to comment
blueman2 Posted October 6, 2015 Share Posted October 6, 2015 I have sent a request to BWS the Author of the emulator to see if he will make a change, ideally to allow math on the value spoken, or allow for ${intensity.temperature} which will send the ISY 2 times the value spoken. That would sure make it easier. Very ISY specific, but would be very nice. Quote Link to comment
tianlung4028 Posted October 6, 2015 Share Posted October 6, 2015 Just looking at the error suggests that you should be at administrator level. Try running the mapper program as admin (right click the exe and select run as administrator). No program should put operational data into the system32 directory but rather into a directory related to itself or to the user. I have written a different program that works with the newer version of the Hue Emulator as developed by BWS Systems. You can find a lot of information regarding the BWS Hue Emulator and my configuration program (AWS_CONFIG) in this thread That's what it was. Thanks for replying. Feel kinda derpy but I guess that's what another pair of eyes are for. Now trying to figure out port conflicts as Echo can't find devices. Quote Link to comment
blueman2 Posted October 6, 2015 Share Posted October 6, 2015 (edited) Alexa control of Heater and AC is now working great!!!!!!!!!! (Edit: No, it is not!!.... see 2 posts below) Silly me, this was much easier than I thought! I upgraded to ISY firmware 5.02, and am now able to set my AC and Heater with my Echo! Steps I followed: create a State Variable in ISY called Air_Conditioner. Note the ID number for that state variable (just to the left of the name). using Barry's tool, create an echo device link for your Insteon Thermostat. For me, I used the Thermostate-Main entry to create the device link. Rename it to Air Conditioner Then go back and edited the On URL entry, replacing the rest command with: /rest/vars/set/2/<state_id_number>/${intensity.percent}. Put in your state ID #. now create a program as follows in ISY: IF $Air_Conditioner >= 68 Then Set 'Thermostat - Main' Cool Setpoint '$Air_Conditioner Degrees' Else Now, if you say "Alexa, set Air Conditioner to 70", it will set your cool point to 70 degrees!! The reason for the IF is twofold - makes sure you do not set your AC to some ridiculously low setting - Causes the program to run anytime you change the setting via Alexa Give it a try!! you can do the same for your Heater Setpoint by making the obvious changes. Edited October 7, 2015 by blueman2 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.