jason0x43 Posted April 1, 2013 Share Posted April 1, 2013 (edited) I wrote a workflow to control my Nest thermostat a few days ago. When I was 90% done and was looking for a last bit of how-to info, I saw Nate's fully functional workflow in the forums. Oh well, nothing says fun like a little duplication of effort. My workflow currently lets you see the Nest's general status, away status, target temp, and local weather, and it will let you toggle the away status and set the target temp. It uses a different technique than Nate's to get your login information--I open dialogs via AppleScript to ask for your email and password, which keeps them out of Alfred's history. To use the workflow, just install it, type 'nest' in the Alfred input window, and select one of the available commands. If you need to authenticate the workflow will ask for your login information. Once that's done you should be good to go. The workflow is written in Python with a couple of embedded AppleScripts for the dialogs. It's available at https://github.com/jason0x43/jc-nest. Download Update 2014/03/19 (again): The weather command should now show temperatures in Celsius if that's how your Nest is configured. Update 2014/03/19: I updated the workflow to use TLSv1 because of recent updates to the Nest API servers. Update 2014/02/06: I added a "clear" command to make it easier to clear the workflow's session data. Doing this, which basically logs the workflow out of nest.com so that it has to create a new session, can help when the workflow isn't...flowing. Update 2013/10/06: Bug fixes Update 2013/08/30.4: A bunch of small updates were made to fix issues with multi-nest support. Update 2013/08/30: I added support for multiple Nests (for those of you lucky enough to be in that situation...sigh). You can use the "nest nest" command to list your Nests and choose the current active one. Update 2013/08/20: Fixed a major bug in how actions were being called (they weren't). Update 2013/08/14: Added support for Alleyoop updating. Login info is now stored in the Mac OS Keychain Edited March 20, 2014 by jason0x43 Link to comment
jason0x43 Posted April 25, 2013 Author Share Posted April 25, 2013 Just updated the workflow to support temperate range mode (heat/cool) Link to comment
Danbush Posted April 25, 2013 Share Posted April 25, 2013 How do you put in username and password? I know you say "I open dialogs via AppleScript" but how do I get it to do this/where do I go? Link to comment
jason0x43 Posted April 25, 2013 Author Share Posted April 25, 2013 How do you put in username and password? I know you say "I open dialogs via AppleScript" but how do I get it to do this/where do I go? Just try any of the commands. The first time you try to do anything (get status, set temp, etc) the workflow will ask you for you login info. Link to comment
Danbush Posted April 25, 2013 Share Posted April 25, 2013 (edited) I'm gettin' 'Error: "OK"' when I try a command. Sorry, new to this. Edited April 25, 2013 by Danbush Link to comment
jason0x43 Posted April 25, 2013 Author Share Posted April 25, 2013 I'm gettin' 'Error: "OK"' when I try a command. Sorry, new to this. Hmmm...let me look into it a bit more and see if I can reproduce the problem. Could you tell me what version of Alfred you're using? And is this the first time you've tried this workflow, or are you upgrading from the previous version? Link to comment
Danbush Posted April 25, 2013 Share Posted April 25, 2013 Awesome, sounds good. Alfred v2.0.3 (187) and This is the first time. In fact, first day with Powerpack haha Link to comment
jason0x43 Posted April 26, 2013 Author Share Posted April 26, 2013 Awesome, sounds good. Alfred v2.0.3 (187) and This is the first time. In fact, first day with Powerpack haha The problem should be fixed now--just download and install it again. Basically I had upgraded one part of my code without updating the other parts that were using it. Sorry about that. Link to comment
hzlzh Posted April 26, 2013 Share Posted April 26, 2013 Share it on the workflow list below~ Link to comment
Danbush Posted April 26, 2013 Share Posted April 26, 2013 The problem should be fixed now--just download and install it again. Basically I had upgraded one part of my code without updating the other parts that were using it. Sorry about that. Works great! Link to comment
natejacobs Posted July 5, 2013 Share Posted July 5, 2013 I came back to the forums to see if anybody else had tackled the idea, as I am gearing up to update my version with more control, and saw this one. Looks good. I am going to be changing up the authentication piece to use this neat little app which stores the users credentials in the keychain. It solves the problem of having the user store their credentials in the plist (my problem) and the problem of having to authenticate every so often after the session cookie expires (your problem). Link to comment
jason0x43 Posted July 7, 2013 Author Share Posted July 7, 2013 I came back to the forums to see if anybody else had tackled the idea, as I am gearing up to update my version with more control, and saw this one. Looks good. I am going to be changing up the authentication piece to use this neat little app which stores the users credentials in the keychain. It solves the problem of having the user store their credentials in the plist (my problem) and the problem of having to authenticate every so often after the session cookie expires (your problem). Yeah, I've started using the keychain in some other workflows I've been playing around with on my system, although just directly from Python rather than with an app. It definitely makes life easier. That Authenticate app looks pretty neat, I'll have to try it out. Link to comment
jason0x43 Posted August 15, 2013 Author Share Posted August 15, 2013 (edited) I just uploaded a new version of the workflow. This one adds support for Alleyoop updating, and it stores your Nest login info in the Mac OS Keychain Edited August 15, 2013 by jason0x43 Link to comment
Richman777 Posted August 20, 2013 Share Posted August 20, 2013 Not sure if this is an issue but seems like I can't set the temperature. I type "nest temp" and the current temp comes up and then I add "74" (so the command looks like "nest temp 74") and hit enter. I'll get an empty notification in notification center that just says "Nest" and the nest doesn't respond. Link to comment
jason0x43 Posted August 20, 2013 Author Share Posted August 20, 2013 Not sure if this is an issue but seems like I can't set the temperature. I type "nest temp" and the current temp comes up and then I add "74" (so the command looks like "nest temp 74") and hit enter. I'll get an empty notification in notification center that just says "Nest" and the nest doesn't respond. That was, indeed, an issue. It should be fixed now. Link to comment
Richman777 Posted August 20, 2013 Share Posted August 20, 2013 Thanks for the quick response - works like a charm. Link to comment
meadeiator Posted August 21, 2013 Share Posted August 21, 2013 Love the workflow. Thanks for your time and for sharing. I'm in near Nest Nirvana...now if only I could control the second thermostat. :-) Link to comment
jason0x43 Posted August 21, 2013 Author Share Posted August 21, 2013 Love the workflow. Thanks for your time and for sharing. I'm in near Nest Nirvana...now if only I could control the second thermostat. :-) Hmmm...that shouldn't actually be too hard, although me only having a single Nest to test with makes things trickier. I have the beginnings of a plan, though. Link to comment
meadeiator Posted August 23, 2013 Share Posted August 23, 2013 Let me know if I can help test it out. Happy to pitch in however I can. Link to comment
jason0x43 Posted August 30, 2013 Author Share Posted August 30, 2013 I just posted an update with initial support for multiple Nests. In this version, a new "nest nest" command has been added to let you see the available Nests on your account and select an active one. Let me know how/if it works. Link to comment
meadeiator Posted August 30, 2013 Share Posted August 30, 2013 Very cool. Quick question. I deleted the old workflow, installed the new and when I attempt to do any of the commands it appears to attempt to connect to Nest but quickly times out and just leaves the commands in Alfred's input box. I thought perhaps I needed to refresh credentials, so I deleted the jc-nest password from keychain hoping to re-prompt for credentials again but to no avail. Just downloaded off GitHub minutes ago so think I have the most current version. Any suggestions? Link to comment
jason0x43 Posted August 30, 2013 Author Share Posted August 30, 2013 Let me try installing a fresh copy and see if I can reproduce that. Link to comment
jason0x43 Posted August 30, 2013 Author Share Posted August 30, 2013 It seemed to work fine. Try downloading it again. I uploaded a new version, then uploaded a bugfix version a few minutes afterwards. You may have the bad one. Link to comment
meadeiator Posted August 30, 2013 Share Posted August 30, 2013 (edited) Ok, to confirm it is pulling the workflow from http://dl.dropbox.com/s/qmu1iyora9h6pr9/jc-nest.alfredworkflow I have deleted the old. For good measure, I cleaned out the volatile and non-volatile Workflow Data for jc-nest. Deleted the password from keychain. Then did a clean install. It prompts me for login information...confirms I'm all set and ready to go. On any of the commands, I see "Talking to Nest..." for about 1 second or so below the input box and the selected filter item. Then it just goes away. On the "nest nest" command it says "Finding Nests..." and then times out the same. Happy to continue and test. Edited August 30, 2013 by meadeiator Link to comment
jason0x43 Posted August 30, 2013 Author Share Posted August 30, 2013 Ok, I uploaded a new version with a "log" command that will show the workflow's debug log in Console.app. Run that to show the log, then try accessing your nest. That should, hopefully, give us a better idea of what's failing. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now