WemoCLI and Events

When creating a rule set using WemoManager (or WemoRemote in this case) rules can be triggered using "OnEvent". On the android version of WemoManager, these events could be triggered locally using a broadcast event. The java WemoServer of course does not have that capability, so an event REST server can be started. Set the desired port in the Ports->WemoEvent menu item. Port 4030 is a good choice.

Events are named in the OnEvent rule definition, and the event rules operate like any other WemoRule.

The events can be triggered on the java WemoServer with an HTTP GET/PUT/POST (PUT is the appropriate way) to:

http://your.server.ip:port/event/{eventName}

e.g.

http://localhost:4030/event/GarageLightOn, assuming you have an OnEvent defined on the server with that name (and that it turns the Garage light on!).

WemoServer will respond with HTTP RC 200 (OK) if the request is successful. The body of the response will contain the event device state.

The WemoCLI client can issue the same post request (note the -cp rather than -jar):

java -cp WemoServer.jar mpp.wemo.server.WemoCLI -event eventName -url url -port port

e.g.

java -cp WemoServer.jar mpp.wemo.server.WemoCLI -event GarageLightOn

will HttpPUT to http://localhost:4030/event/GarageLightOn

while

java -cp WemoServer.jar mpp.wemo.server.WemoCLI -event GarageLightOn -url http://192.168.0.100 -port 4030

will HttpPUT to http://192.168.0.100:4030/event/GarageLightOn

The WemoServer.jar command line operation WemoCLI can be used on any system with the correct level of java installed (and the authority to make HTTP PUT requests).