WEMO Application

Showing results for 
Search instead for 
Do you mean 
Reply
Posts: 1,064
Registered: ‎12-08-2014

Command Line control of your Wemos - script / OS X Mail / Google Calendar

[ Edited ]

I've played with this in the past but this newer version of script seems to work with even the Maker.

 

http://moderntoil.com/?p=839

 

Use this new script in comments at the bottom by Jack Lawry.

 

http://www.codedpixel.co.uk/wemo/wemo_control.sh.zip

 

You have the following commands available to you:

 

ON

 

OFF

 

GETSTATE

 

GETSIGNALSTRENGTH

 

GETFRIENDLYNAME

 

 

For a Maker in momentary switch mode just send the ON command.  I notice my Holmes filters won't respond to ON or OFF but other commands works.

 

The beta firmware that I am testing doesn't work with Ouimeaux on the Wemo switches.  It works fine with light switches.  This is a nice option for remote site control.

Posts: 1,064
Registered: ‎12-08-2014

Re: Command Line control of your Wemos - script

[ Edited ]

Running this as a shell script one could use for timer based functions when setup as a scheduled cron job. I am running this off of a Raspberry Pi and building a basic web page to drive it.

Posts: 1,064
Registered: ‎12-08-2014

Re: Command Line control of your Wemos - script

An easier way to schedule scripts on the Mac side of the house anyway is via the Calendar app if you don't want to use something like Cron or launchd

 

Screen Shot 2015-03-11 at 4.00.19 PM.png

Posts: 1,064
Registered: ‎12-08-2014

Re: Command Line control of your Wemos - script

[ Edited ]

On OS X:   I haven't done this yet but one could also utilize an Applescript that calls a shell script based on a rule from OS X Mail.  I would probably dedicate a specialized email account for this purpose though.

 

I have built some shell scripts to turn everything on or off....but easy enough to do individually as well.

 

Screen Shot 2015-03-11 at 5.12.55 PM.png

 

 

 

Posts: 1,064
Registered: ‎12-08-2014

Re: Command Line control of your Wemos - script

I got things setup so a simple email configured with an email client (IMAP) on an OS X workstation with a Gmail account can turn on or off a light within about 10-15 seconds. I'm mainly concerned about a failsafe fall back so all Wemo's can be turned on or off with a single email.
Posts: 1,064
Registered: ‎12-08-2014

Re: Command Line control of your Wemos - script

I can use the local Calendar app but wanted something I could manage from the cloud so I found I can use Google Calendar to schedule the Wemos.

Then I setup an OS X mail rule that launches when the Google Calendar notification is received. This then launches an Applescript which then launches the shell script that controls the Wemo. The OS X mail won't launch the shell script directly so I have to use the Applescript. All-in-all events all happens in less than a minute.
Posts: 1,064
Registered: ‎12-08-2014

Re: Command Line control of your Wemos - script

If you don't run Linux, OS X, BSD, etc and only have Windows you can still run shell script files .sh with this--->

http://www.cygwin.com/

I love the instant ON & Off I can get with a script.
Posts: 1,064
Registered: ‎12-08-2014

Re: Command Line control of your Wemos - script

[ Edited ]

Someone posted a new version that supports Wemo LEDs as well.

 

http://guino.home.insightbb.com/wemo_control.sh

 

Make sure you have wget installed on your system.  It won't work fully without it.

 

Usage: wemo IP_ADDRESS[Smiley TongueORT] ON|OFF|TOGGLE|GETSTATE|GETSIGNALSTRENGTH|GETFRIENDLYNAME

   or: wemo IP_ADDRESS[Smiley TongueORT] LINK [LIST|NAME ON [0-255]|OFF|TOGGLE|GETSTATE]

 

Examples

 

./wemo_control_LED.sh IP_of_Link LINK 'bulb_name' OFF

 

./wemo_control_LED.sh IP_of_Link LINK 'bulbname' ON

 

./wemo_control_LED.sh IP_of_Link LINK LIST

 

Dim Levels:

 

./wemo_control_LED.sh IP_of_Link LINK ON 0-255

 

 

 

 

My grouped bulbs don't seem to work but individual control functions.

 

 

 

 

Posts: 18
Registered: ‎08-16-2015

Re: Command Line control of your Wemos - script

[ Edited ]

Thank you,

Since two days I'm experimenting with command line tools to turn on and off my 9 WeMo Devices.

 

This script seems to be the most advanced, because it has TOGGLE and LINK LED-Ability (and other commands) included. (and is fast with adressing as far as i can say. Also addresses all ports)

 

(I found another script, dated 08/2015 with find command and only addressing different ports (hardcoeded). Find (all IP devices) Command seems a good idea, but won't work on mac unless you install nmap.)

 

I used Apple Script Editor with following command and exported it to an app, which i can click as a button on my desk/dock, or autostart, etc.:

 

do shell script "sh /Users/myusername/wemo_control.sh 10.0.1.xx TOGGLE"

 

Change "myusername" or change path to your script and change 10.0.1.xx to your WeMo's IP Address.

 

So above script works great for me.

Thank you!

Posts: 1,064
Registered: ‎12-08-2014

Re: Command Line control of your Wemos - script

[ Edited ]

I'm using these scripts running off of a Rapsbery Pi as a backup connection for my Wemos.  

 

Along with the $3/month T-mobile  plan and Automagic (Thanks MikeP for directing me to this).  You just need to park a cheap $20-$30 Android phone at your remote site.

 

Automagic is so usefull as I can send the phone a text message and have it execute the shell command on the Pi from the phone.  This would also be useful for someone who has cell coverage and no internet but also wants remote automation control. The product has such a wide array of capabilities... too much to go into here.

 

Granted you only get 30 text messages with this $3 plan but is about the cheapest option for a remote backdoor I could find. Additional messages are $.10 but far cheaper than other travel options to address a remote outage.

 

EDIT:  If Android rooted phone can execute script directly one less thing you have to run instead of the Pi.  I have limited Android experience so not sure if that is possible or not.

 

Automagic Actions

Automagic Conditions

Automagic Triggers