Call activity from http

Is there a way to call an activity from http?

The use case is to send a command through home bridge/Siri

I realize an activity could be scripted into a scene, then called from http or reactor. I find myself pushing more complex scenes into reactor, it is just how I am organized. I am converting from pleg, and this is the only functionality I can’t seem to replicate.

All actions supported for any device can be accessed via HTTP using a Luup request of the form:

http://vera-local-ip/port_3480/data_request?id=action&output_format=xml&DeviceNum=XXX&serviceId=SERVICEID&action=ACTIONNAME&parameter=value...

So to turn on a light in the standard SwitchPower1 service:

http://ip_address/port_3480/data_request?id=action&output_format=xml&DeviceNum=15&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=1

Now, to run a ReactorSensor’s activity, there is a RunScene action in service urn:toggledbits-com:serviceId:ReactorSensor. It takes a single parameter, SceneNum, which despite what its name implies, can be an activity name. The activity name is the group’s name or ID with either “.true” or “.false” appended, depending on which you want to run. If you use a group name, it does not matter if the name contains spaces or other punctuation, just be aware that if you change the group name in the ReactorSensor, you will need to change the URL wherever you use it as well.

http://ip_address:3480/data_request?id=action&output_format=xml&DeviceNum=123&serviceId=urn:toggledbits-com:serviceId:ReactorSensor&action=RunScene&SceneNum=root.true

You can look in the Logic Summary of the ReactorSensor to see if the action was accepted and run. If there is an error, look in the LuaUPnP log file for information.

This action can also make Reactor run a standard/native Vera scene if you give it a scene name or number.

Docs: Service Definition - Reactor

1 Like

You sir, are the man. Very well done all around, beer money enroute.

1 Like