Controlling appliance module thru windows (command line)


(Scott Windmiller) #1

What would be the easiest way to control an appliance module thru windows using a command line or batch file?
I have a whole house jukebox that is controlled thru a touchscreen mounted in the wall. Right now I have an old x10 module that switches off my amp when I put the pc to sleep. This module is starting to fail and I want to replace it and use a ST appliance module. I basically just need to switch it on and off via command line. I’m just using a simple batch file right now.
What would be the easiest way to do this?


(Ron) #2

Off the top of my head what about an IFTTT email trigger. Pretty easy to send email from a command line.


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #3

curl (there’s several versions of Windows) to a simple https mapping SmartApp exposing the Appliance Module as an endpoint.f


(sidjohn1) #4

You can also buy 2 ST appliance modules. 1 for your computer and 1 for your amp. Tie them together with this smartapp:


So when you put any computer to sleep the watts will drop and turn off your amp. You can tweak my code to get it to work the other way… Or ask me really nice to write you a turn it on when in use smartapp.


(Scott Windmiller) #5

Thanks everyone for the help, all of these could work!

@Ron, this would probably be the easiest and will try it out. I just have to make sure it’s fast and consistent.
@tgauchat, thanks. I have never used curl but will install it and try it out
@sidjohn1, thanks for the offer and I may take you up on that :slight_smile: The only issue I see with this is having to use another module. I have to see what other uses I could use the module on the PC for. This approach would be the most “automatic” though.

My wife mainly uses this so it HAS TO WORK every time…lol. Stuff always seems to break when I am not there.


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #6

If you aim for the curl approach, keep in touch w/me (PM or whatever).

I actually have a similar use case in mind and might have a chance to test it in advance.

@sidjohn1’s approach is great for many situations. I’m going to try an Appliance Module on my home theatre projector outlet, as the current draw can be used to trigger lighting, screen, etc., actually!


(Scott Windmiller) #7

Thanks and I will do that.

I had never thought of using an appliance module other than turning something on and off. Using the current draw opens up alot of possibilities. Being able to get the modules for around $30 a pop makes it even better :smile:


(Scott Windmiller) #8

Bringing back my other thread as I still have not done this yet :smile:
@tgauchat, I am interested in using the endpoint method but seem to be having the hardest time wrapping my head around the concept of endpoints and what they do. I have went thru the endpoint tutorial Ben posted a while back and have not had any success getting it to work. I have since just bought an Amazon Echo and am interested in using endpoints for that as well so that brought me back to this project as well, 2 birds with one stone :smile:

After doing some searching I found that I was able to get a working endpoint url through my SmartTiles smartapp, basically by using the F12/Console of my browser and clicking a SmartTiles tile would give me the url in the console window. Putting that in my browser allows me to toggle that particular switch on and off with each load…cool stuff!
Although I don’t think this is the ideal way to get the endpoint url.

Can you give me some guidance on this?
Thanks,
Scott


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #9

I actually often suggest SmartTiles as a way to grasp the power of setting up REST-API Endpoints, even though it is a relatively complex SmartApp. The point being that if you manage to walk through the App, you’ll have learned a bunch of great techniques.

However, to focus on the requirement for a “command line” interface, we’ll definitely want to use or create a much simpler bare bones example and then build upon it.

The Developer Documentation has been updated quite a bit, so let’s both check that to see if it’s any clearer on the topic and example(s). The difficult part is the Authentication process, unless you happen to be quite familiar with OAuth already… But there are several recent threads that walk through those steps as well… I just have to find one rather than writing out the steps myself!

Do you have curl installed?


(Scott Windmiller) #10

Well I did install curl and was able to use that with the url I got from SmartTiles app and that did work. Stupid question, is that url tied to that SmartApp? In other words if I were to delete that app would the endpoint url still work?
Would I create an app specifically to get the endpoint urls?
I know nothing about OAuth (the first time I heard of it was through ST) but am learning.
I have to learn by doing so reading something does it always help me but following a guide will work.
When I get home I do some more searching.
Thanks for any help you can give.


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #11

No questions are stupid. Well… some questions might be, but, regardlesss…

  1. Is that url tied to that SmartApp? YES

  2. In other words if I were to delete that app would the endpoint url still work? NO

  3. Would I create an app specifically to get the endpoint urls? YES
    There was a time that all your Devices would have a default Endpoint with no SmartApp required, but I think that feature no longer exists (for enhanced security reasons). No big deal. Search for ThingLayer (linked below) for a SmartApp that seems to create endpoints for nearly everything!

  4. I know nothing about OAuth (the first time I heard of it was through ST) but am learning.
    Same here… Luckily the Documentation is updated on this and there are some good examples (but, NB: the process has changed recently to meet enhanced specifications, so be sure to reference “current” examples).


(Scott Windmiller) #12

Thanks for all the info!!
I think I am getting tired as thing layer is not making sense to me …lol I will look at it more tomorrow but it seems like more than what I need.

Would it be bad to install a copy of SmartTiles just for the purpose of Endpoints? Ok maybe that was a stupid question but had to ask :smile:

Thanks for helping me out!


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #13

Based on my understanding of ThingLayer, it would be the better choice than SmartTiles if you’re looking to reuse an existing SmartApp “just for Endpoints”.

But if you’re not in a super rush and understand the basic structure of SmartApp development, the best option is to code your own simple Endpoint from understanding the available examples. We can Skype or PM or to go through the process together.


(Scott Windmiller) #14

Yeah, my preference would be to have my own app specifically for just creating endpoints. I was trying a few things last night following the documentation here although I was getting tired quick :smile:

PM would be great if you would not mind walking thru it with me.

Thanks,
Scott