Luup Requests

From MiOS
(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
 
[[Category:Development]]
 
[[Category:Development]]
 
In addition to sending requests using standard UPnP, you can also do most things using a simple HTTP requests.  Use the built-in URL <tt>data_request</tt>, and pass the following on the URL:
 
In addition to sending requests using standard UPnP, you can also do most things using a simple HTTP requests.  Use the built-in URL <tt>data_request</tt>, and pass the following on the URL:
*<tt>id</tt> the id of the request,  
+
*<tt>id</tt> the id of the request (prior to 15 Oct 2010 all requests had an lu_ in front, which is now optional),  
 
*<tt>output_format</tt> the format in which you want a response as <tt>json</tt>, <tt>xml</tt> or <tt>text</tt>.
 
*<tt>output_format</tt> the format in which you want a response as <tt>json</tt>, <tt>xml</tt> or <tt>text</tt>.
  
Line 12: Line 12:
 
This returns the configuration data for Vera, which is a list of all devices and the UPnP variables which are persisted between resets as well as rooms, names, and other data the user sets as part of the configuration.
 
This returns the configuration data for Vera, which is a list of all devices and the UPnP variables which are persisted between resets as well as rooms, names, and other data the user sets as part of the configuration.
  
==lu_status==
+
==status==
  
Example: http://ipaddress:3480/data_request?id=lu_status&output_format=xml
+
Example: http://ipaddress:3480/data_request?id=status&output_format=xml
  
Or for a specific device: http://ipaddress:3480/data_request?id=lu_status&output_format=xml&UDN=uuid:4d494342-5342-5645-0002-000000000002 or http://ipaddress:3480/data_request?id=lu_status&output_format=xml&DeviceNum=6
+
Or for a specific device: http://ipaddress:3480/data_request?id=status&output_format=xml&UDN=uuid:4d494342-5342-5645-0002-000000000002 or http://ipaddress:3480/data_request?id=status&output_format=xml&DeviceNum=6
  
 
This returns the current status for all devices including all the current upnp variables and the status of any active jobs.
 
This returns the current status for all devices including all the current upnp variables and the status of any active jobs.
  
==lu_actions==
+
==actions==
  
==lu_device==
+
==device==
  
Example: http://ipaddress:3480/data_request?id=lu_device&action=rename&device=5&name=Chandalier&room=3
+
Example: http://ipaddress:3480/data_request?id=device&action=rename&device=5&name=Chandalier&room=3
  
Example: http://ipaddress:3480/data_request?id=lu_device&action=rename&device=5&name=Chandalier&room=Garage
+
Example: http://ipaddress:3480/data_request?id=device&action=rename&device=5&name=Chandalier&room=Garage
  
Example: http://ipaddress:3480/data_request?id=lu_device&action=delete&device=5
+
Example: http://ipaddress:3480/data_request?id=device&action=delete&device=5
  
 
This renames or deletes a device.  Use action=rename or action=delete.  For rename, you can optionally assign a room by either passing either the ID or the name.
 
This renames or deletes a device.  Use action=rename or action=delete.  For rename, you can optionally assign a room by either passing either the ID or the name.
Line 35: Line 35:
  
 
---old---
 
---old---
This returns all the XML with all the UPNP device description documents.  Use: http://ipaddress:3480/data_request?id=lu_device&output_format=xml&DeviceNum=x or &UDN=y to narrow it down.  Then when you see the service URL's, like <SCPDURL>/luvd/S_HVAC_UserOperatingMode1.xml</SCPDURL>, you can view them with: http://ipaddress:3480/luvd/S_HVAC_UserOperatingMode1.xml
+
This returns all the XML with all the UPNP device description documents.  Use: http://ipaddress:3480/data_request?id=device&output_format=xml&DeviceNum=x or &UDN=y to narrow it down.  Then when you see the service URL's, like <SCPDURL>/luvd/S_HVAC_UserOperatingMode1.xml</SCPDURL>, you can view them with: http://ipaddress:3480/luvd/S_HVAC_UserOperatingMode1.xml
 
---end old---
 
---end old---
  
==lu_scene==
+
==scene==
  
Example: http://ipaddress:3480/data_request?id=lu_scene&action=create&device=5,7,3,1&name=Wakeup&room=5
+
Example: http://ipaddress:3480/data_request?id=scene&action=create&device=5,7,3,1&name=Wakeup&room=5
  
Example: http://ipaddress:3480/data_request?id=lu_scene&action=rename&scene=5&name=Chandalier&room=Garage
+
Example: http://ipaddress:3480/data_request?id=scene&action=rename&scene=5&name=Chandalier&room=Garage
  
Example: http://ipaddress:3480/data_request?id=lu_scene&action=delete&scene=5
+
Example: http://ipaddress:3480/data_request?id=scene&action=delete&scene=5
  
 
This creates, renames, or deletes a scene depending on the action.  To create a scene, pass the id's of the device(s) to include in the scene comma delimited, and optionally pass a room by name or number.
 
This creates, renames, or deletes a scene depending on the action.  To create a scene, pass the id's of the device(s) to include in the scene comma delimited, and optionally pass a room by name or number.
  
==lu_room==
+
==room==
  
Example: http://ipaddress:3480/data_request?id=lu_room&action=create&name=Kitchen
+
Example: http://ipaddress:3480/data_request?id=room&action=create&name=Kitchen
  
Example: http://ipaddress:3480/data_request?id=lu_room&action=rename&room=5&name=Garage
+
Example: http://ipaddress:3480/data_request?id=room&action=rename&room=5&name=Garage
  
Example: http://ipaddress:3480/data_request?id=lu_scene&action=delete&room=5
+
Example: http://ipaddress:3480/data_request?id=scene&action=delete&room=5
  
 
This creates, renames, or deletes a room depending on the action.  To rename or delete a room you must pass the room id for the room=.
 
This creates, renames, or deletes a room depending on the action.  To rename or delete a room you must pass the room id for the room=.
  
==lu_file==
+
==file==
  
==lu_lua==
+
==lua==
  
==lu_action==
+
==action==
  
Example: http://ipaddress:3480/data_request?id=lu_action&output_format=xml&DeviceNum=6&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=1
+
Example: http://ipaddress:3480/data_request?id=action&output_format=xml&DeviceNum=6&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=1
  
 
Sends a UPnP action.
 
Sends a UPnP action.
Line 70: Line 70:
 
To run a scene, you send the action 'RunScene' to the internal 'Scene Manager' device (which has ID #2):
 
To run a scene, you send the action 'RunScene' to the internal 'Scene Manager' device (which has ID #2):
  
http://ipadress:3480/data_request?id=lu_action&output_format=xml&DeviceNum=2&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum=<SceneNum>
+
http://ipadress:3480/data_request?id=action&output_format=xml&DeviceNum=2&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum=<SceneNum>
  
==lu_variableset==
+
==variableset==
  
http://ip:3480/data_request?id=lu_variableset&DeviceNum=6&serviceId=urn:micasaverde-com:serviceId:DoorLock1&Variable=Status&Value=1
+
http://ip:3480/data_request?id=variableset&DeviceNum=6&serviceId=urn:micasaverde-com:serviceId:DoorLock1&Variable=Status&Value=1
  
==lu_variableget==
+
==variableget==
  
http://ip:3480/data_request?id=lu_variableget&DeviceNum=6&serviceId=urn:micasaverde-com:serviceId:DoorLock1&Variable=Status
+
http://ip:3480/data_request?id=variableget&DeviceNum=6&serviceId=urn:micasaverde-com:serviceId:DoorLock1&Variable=Status
  
==lu_reload==
+
==reload==
  
 
Resets the Luup engine with any new configuration settings.
 
Resets the Luup engine with any new configuration settings.
  
==lu_alive==
+
==alive==
  
 
Return OK if the engine is running.
 
Return OK if the engine is running.
  
==lu_finddevice==
+
==finddevice==
  
 
Return the device id, UDN, device type of the first device that matches all the parameters passed on the URL: <tt>devtype</tt>, <tt>ip</tt>, <tt>id</tt>
 
Return the device id, UDN, device type of the first device that matches all the parameters passed on the URL: <tt>devtype</tt>, <tt>ip</tt>, <tt>id</tt>
  
==lu_resync==
+
==resync==
  
 
ReSync's all the devices, rooms, users, sections with event servers and returns OK
 
ReSync's all the devices, rooms, users, sections with event servers and returns OK
  
==lu_wget==
+
==wget==
  
 
Returns the contents of the URL you pass in the "url" argument.  Optionally append "user" and "pass" arguments for http authentication, and "timeout" to specify the maximum time to wait in seconds.
 
Returns the contents of the URL you pass in the "url" argument.  Optionally append "user" and "pass" arguments for http authentication, and "timeout" to specify the maximum time to wait in seconds.
  
==lu_iprequests==
+
==iprequests==
  
 
Returns the recent IP requests in order by most recent first, including information about devices in use and if the IP is blacklisted (ignored by the plug and play mechanism).  Optionally append "oldest" to specify the oldest IP request in seconds.
 
Returns the recent IP requests in order by most recent first, including information about devices in use and if the IP is blacklisted (ignored by the plug and play mechanism).  Optionally append "oldest" to specify the oldest IP request in seconds.
  
==lu_blacklistip==
+
==blacklistip==
  
 
Append "ip" to the URL, and optionally "remove=1" to add (or remove) the IP to the blacklist so plug and play IP devices won't be added.
 
Append "ip" to the URL, and optionally "remove=1" to add (or remove) the IP to the blacklist so plug and play IP devices won't be added.

Revision as of 17:22, 15 October 2010

In addition to sending requests using standard UPnP, you can also do most things using a simple HTTP requests. Use the built-in URL data_request, and pass the following on the URL:

  • id the id of the request (prior to 15 Oct 2010 all requests had an lu_ in front, which is now optional),
  • output_format the format in which you want a response as json, xml or text.

Not all requests support all output_format options. Here is a list of requests:

Contents

user_data

Example: http://ipaddress:3480/data_request?id=user_data&output_format=xml

This returns the configuration data for Vera, which is a list of all devices and the UPnP variables which are persisted between resets as well as rooms, names, and other data the user sets as part of the configuration.

status

Example: http://ipaddress:3480/data_request?id=status&output_format=xml

Or for a specific device: http://ipaddress:3480/data_request?id=status&output_format=xml&UDN=uuid:4d494342-5342-5645-0002-000000000002 or http://ipaddress:3480/data_request?id=status&output_format=xml&DeviceNum=6

This returns the current status for all devices including all the current upnp variables and the status of any active jobs.

actions

device

Example: http://ipaddress:3480/data_request?id=device&action=rename&device=5&name=Chandalier&room=3

Example: http://ipaddress:3480/data_request?id=device&action=rename&device=5&name=Chandalier&room=Garage

Example: http://ipaddress:3480/data_request?id=device&action=delete&device=5

This renames or deletes a device. Use action=rename or action=delete. For rename, you can optionally assign a room by either passing either the ID or the name.


---old--- This returns all the XML with all the UPNP device description documents. Use: http://ipaddress:3480/data_request?id=device&output_format=xml&DeviceNum=x or &UDN=y to narrow it down. Then when you see the service URL's, like <SCPDURL>/luvd/S_HVAC_UserOperatingMode1.xml</SCPDURL>, you can view them with: http://ipaddress:3480/luvd/S_HVAC_UserOperatingMode1.xml ---end old---

scene

Example: http://ipaddress:3480/data_request?id=scene&action=create&device=5,7,3,1&name=Wakeup&room=5

Example: http://ipaddress:3480/data_request?id=scene&action=rename&scene=5&name=Chandalier&room=Garage

Example: http://ipaddress:3480/data_request?id=scene&action=delete&scene=5

This creates, renames, or deletes a scene depending on the action. To create a scene, pass the id's of the device(s) to include in the scene comma delimited, and optionally pass a room by name or number.

room

Example: http://ipaddress:3480/data_request?id=room&action=create&name=Kitchen

Example: http://ipaddress:3480/data_request?id=room&action=rename&room=5&name=Garage

Example: http://ipaddress:3480/data_request?id=scene&action=delete&room=5

This creates, renames, or deletes a room depending on the action. To rename or delete a room you must pass the room id for the room=.

file

lua

action

Example: http://ipaddress:3480/data_request?id=action&output_format=xml&DeviceNum=6&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=1

Sends a UPnP action.

To run a scene, you send the action 'RunScene' to the internal 'Scene Manager' device (which has ID #2):

http://ipadress:3480/data_request?id=action&output_format=xml&DeviceNum=2&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum=<SceneNum>

variableset

http://ip:3480/data_request?id=variableset&DeviceNum=6&serviceId=urn:micasaverde-com:serviceId:DoorLock1&Variable=Status&Value=1

variableget

http://ip:3480/data_request?id=variableget&DeviceNum=6&serviceId=urn:micasaverde-com:serviceId:DoorLock1&Variable=Status

reload

Resets the Luup engine with any new configuration settings.

alive

Return OK if the engine is running.

finddevice

Return the device id, UDN, device type of the first device that matches all the parameters passed on the URL: devtype, ip, id

resync

ReSync's all the devices, rooms, users, sections with event servers and returns OK

wget

Returns the contents of the URL you pass in the "url" argument. Optionally append "user" and "pass" arguments for http authentication, and "timeout" to specify the maximum time to wait in seconds.

iprequests

Returns the recent IP requests in order by most recent first, including information about devices in use and if the IP is blacklisted (ignored by the plug and play mechanism). Optionally append "oldest" to specify the oldest IP request in seconds.

blacklistip

Append "ip" to the URL, and optionally "remove=1" to add (or remove) the IP to the blacklist so plug and play IP devices won't be added.

live_energy_usage

For backward compatibility it reports current energy usage in a tab delimited format

Personal tools