Luup Requests
(→request_image or request_video) |
(→user_data) |
||
(48 intermediate revisions by 7 users not shown) | |||
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 (prior to 15 Oct 2010 all requests had an lu_ in front, which is now optional), | + | *<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>. | ||
+ | Not all requests support all <tt>output_format</tt> options. | ||
− | + | Here is the list of requests: | |
==user_data== | ==user_data== | ||
− | Example: http:// | + | Example: http://ip_address:3480/data_request?id=user_data |
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. | ||
− | = | + | By default, the user_data is in JSON format, however, you can get it in XML format by adding the <code>output_format=xml</code> parameter: |
− | + | http://ip_address:3480/data_request?id=user_data&output_format=xml | |
− | + | If you don't care about the static data, which is the information from the device json files (e.g. D_BinaryLight1.json) which appears in the ''static_data'' object, then you can add the <code>ns=1</code> parameter: | |
− | This returns the current status for all devices including all the current | + | http://ip_address:3480/data_request?id=user_data&output_format=xml&ns=1 |
+ | |||
+ | ==status== | ||
+ | This returns the current status for all devices including all the current UPnP variables and the status of any active jobs. | ||
+ | |||
+ | |||
+ | Examples: | ||
+ | * http://ip_address:3480/data_request?id=status&output_format=xml | ||
+ | Or for a specific device: | ||
+ | * http://ip_address:3480/data_request?id=status&output_format=xml&UDN=uuid:4d494342-5342-5645-0002-000000000002 | ||
+ | * http://ip_address:3480/data_request?id=status&output_format=xml&DeviceNum=6 | ||
==sdata== | ==sdata== | ||
− | This is an abbreviated form of user_data and status (sdata=summary data). | + | This is an abbreviated form of [[#user_data|user_data]] and [[#status|status]] (sdata = ''summary data''). It allows a user interface that is only worried about control, and not detailed configuration, to get a summary of the data that would normally be presented to the user and to monitor the changes. See [[UI_Simple]] for a walkthrough. |
+ | |||
+ | |||
+ | Examples: | ||
+ | * http://ip_address:3480/data_request?id=sdata | ||
+ | * http://ip_address:3480/data_request?id=sdata&output_format=xml | ||
==actions== | ==actions== | ||
Line 28: | Line 44: | ||
==device== | ==device== | ||
− | Example: http:// | + | Example: http://ip_address:3480/data_request?id=device&action=rename&device=5&name=Chandalier&room=3 |
− | Example: http:// | + | Example: http://ip_address:3480/data_request?id=device&action=rename&device=5&name=Chandalier&room=Garage |
− | Example: http:// | + | Example: http://ip_address: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 | + | This renames or deletes a device. Use action=rename or action=delete. For rename, you can optionally assign a room by passing either the ID or the name. |
---old--- | ---old--- | ||
− | This returns all the XML with all the UPNP device description documents. Use: http:// | + | This returns all the XML with all the UPNP device description documents. Use: http://ip_address: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://ip_address:3480/luvd/S_HVAC_UserOperatingMode1.xml |
---end old--- | ---end old--- | ||
==scene== | ==scene== | ||
− | Example: http:// | + | Example: http://ip_address:3480/data_request?id=scene&action=record |
− | Example: http:// | + | Example: http://ip_address:3480/data_request?id=scene&action=pause&seconds=y |
− | Example: http:// | + | Example: http://ip_address:3480/data_request?id=scene&action=stoprecord |
− | Example: http:// | + | Example: http://ip_address:3480/data_request?id=scene&action=listrecord |
− | Example: http:// | + | Example: http://ip_address:3480/data_request?id=scene&action=deleterecord&number=x |
− | Example: http:// | + | Example: http://ip_address:3480/data_request?id=scene&action=saverecord&name=whatever&room=X |
− | Example: http:// | + | Example: http://ip_address:3480/data_request?id=scene&action=rename&scene=5&name=Chandalier&room=Garage |
− | Example: http:// | + | Example: http://ip_address:3480/data_request?id=scene&action=delete&scene=5 |
− | Example: http:// | + | Example: http://ip_address:3480/data_request?id=scene&action=create&json=[valid json data] |
− | Example: http:// | + | Example: http://ip_address:3480/data_request?id=scene&action=list&scene=5 |
This creates, renames, or deletes a scene depending on the action. | This creates, renames, or deletes a scene depending on the action. | ||
Line 74: | Line 90: | ||
==room== | ==room== | ||
− | Example: http:// | + | Example: http://ip_address:3480/data_request?id=room&action=create&name=Kitchen |
− | Example: http:// | + | Example: http://ip_address:3480/data_request?id=room&action=rename&room=5&name=Garage |
− | Example: http:// | + | Example: http://ip_address:3480/data_request?id=room&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. |
==file== | ==file== | ||
+ | Returns the contents of a file in '''/etc/cmh''' or '''/etc/cmh-ludl'''. Has one parameter, <tt>parameters</tt>, which is the name of the file. | ||
+ | |||
+ | Example: http://ip_address:3480/data_request?id=file¶meters=D_BinaryLight1.xml | ||
==lua== | ==lua== | ||
− | == action | + | == action == |
− | + | Sends a UPnP action. | |
+ | * To call the action for a single device, use <code>DeviceNum</code>. | ||
+ | * To call the action for all devices in the same category, use <code>Category</code>. | ||
− | + | '''Examples:''' | |
− | + | * Turn off a light: | |
+ | http://ip_address:3480/data_request?id=action&output_format=xml&DeviceNum=6&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0 | ||
− | http:// | + | * Set a dimmable light to 30%: |
+ | http://ip_address:3480/data_request?id=action&output_format=json&DeviceNum=7&serviceId=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget&newLoadlevelTarget=30 | ||
+ | |||
+ | * Run a scene: | ||
+ | http://ip_address:3480/data_request?id=action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum=<SceneNum> | ||
+ | |||
+ | * Install a plugin: | ||
+ | http://ip_address:3480/data_request?id=action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=CreatePlugin&PluginNum=<PluginNum> | ||
+ | |||
+ | * Turn off all lights: | ||
+ | http://ip_address:3480/data_request?id=action&output_format=xml&Category=999&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0 | ||
+ | |||
+ | * Arm all sensors: | ||
+ | http://ip_address:3480/data_request?id=action&output_format=xml&Category=4&serviceId=urn:micasaverde-com:serviceId:SecuritySensor1&action=SetArmed&newArmedValue=1 | ||
+ | |||
+ | {{Info|Category 999 is a virtual category which encompasses all devices in category 2 (dimmable lights) and 3 (binary lights).}} | ||
==variableset== | ==variableset== | ||
− | http:// | + | http://ip_address:3480/data_request?id=variableset&DeviceNum=6&serviceId=urn:micasaverde-com:serviceId:DoorLock1&Variable=Status&Value=1 |
If you leave off the DeviceNum and serviceID, then this sets a top-level json tag called "Variable" with the value. | If you leave off the DeviceNum and serviceID, then this sets a top-level json tag called "Variable" with the value. | ||
Line 104: | Line 141: | ||
==variableget== | ==variableget== | ||
− | http:// | + | http://ip_address:3480/data_request?id=variableget&DeviceNum=6&serviceId=urn:micasaverde-com:serviceId:DoorLock1&Variable=Status |
If you leave off the DeviceNum and serviceID, then this gets a top-level json tag called "Variable". | If you leave off the DeviceNum and serviceID, then this gets a top-level json tag called "Variable". | ||
Line 111: | Line 148: | ||
Resets the Luup engine with any new configuration settings. | Resets the Luup engine with any new configuration settings. | ||
+ | |||
+ | Example: http://ip_address:3480/data_request?id=reload | ||
==alive== | ==alive== | ||
Line 118: | Line 157: | ||
==finddevice== | ==finddevice== | ||
− | + | Returns the '''device number''', '''UDN''' and '''device type''' of the first device that matches any or all the parameters passed on the URL: <tt>devtype</tt>, <tt>ip</tt>, <tt>devid</tt>, where <tt>devid</tt> is the ''altid'' of the device. Or instead of <tt>devid</tt>, pass '''<tt>devnum</tt>''' and it will find the device with that number. | |
+ | |||
+ | Example: http://ip_address:3480/data_request?id=finddevice&devid=6 | ||
==resync== | ==resync== | ||
Line 130: | Line 171: | ||
==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 | + | 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 '''<tt>timeout</tt>''' to specify the oldest IP request in seconds. |
+ | |||
+ | Examples: | ||
+ | * This returns the devices which showed up on the network in the past hour: | ||
+ | http://ip_address:3480/data_request?id=iprequests&timeout=3600 | ||
+ | * This returns the devices which showed up on the network in the last 24 hours: | ||
+ | http://ip_address:3480/data_request?id=iprequests&timeout=86400 | ||
==blacklistip== | ==blacklistip== | ||
Line 140: | Line 187: | ||
==live_energy_usage== | ==live_energy_usage== | ||
− | For backward compatibility it reports current energy usage in a tab delimited format | + | For backward compatibility, it reports the current energy usage in a tab delimited format. |
− | = | + | Example: http://ip_address:3480/data_request?id=live_energy_usage |
− | ''' | + | '''Device #''' '''Name''' '''Room''' '''Category''' '''Watts''' |
− | + | 59 Basement Light Basement 3 20 | |
+ | 60 Bedroom Light 1st Floor 3 0 | ||
+ | 61 Porch Light Outside 3 30 | ||
− | Returns an image | + | To display only the watts variable : http://ip_address:3480/data_request?id=variableget&DeviceNum=34&serviceId=urn:micasaverde-com:serviceId:EnergyMetering1&Variable=Watts |
+ | and you must specify the device id for the variable and the service id. | ||
+ | |||
+ | ==request_image== | ||
+ | |||
+ | Returns an image from a camera. This fetches the image from the camera using the URL variable for the device. Pass arguments: | ||
cam = the device id of the camera. This is the only mandatory argument. | cam = the device id of the camera. This is the only mandatory argument. | ||
− | res = optional: a resolution, which gets appended to the variable. So passing "low" means the image from the URL_low variable will be returned. If it doesn't exist it reverts to the standard URL or DirectStreamingURL | + | res = optional: a resolution, which gets appended to the variable. So passing "low" means the image from the URL_low variable will be returned. If it doesn't exist it reverts to the standard URL or DirectStreamingURL |
timeout = optional: how long to wait for the image to be retrieved, or how long to retrieve video. defaults to 10 seconds. | timeout = optional: how long to wait for the image to be retrieved, or how long to retrieve video. defaults to 10 seconds. | ||
url = optional: override the camera's default URL | url = optional: override the camera's default URL | ||
ip = optional: override the camera's default ip | ip = optional: override the camera's default ip | ||
user or pass = optional: override the camera's default username/password | user or pass = optional: override the camera's default username/password | ||
+ | |||
+ | ==archive_video== | ||
+ | ''* UI5+ only'' | ||
+ | |||
+ | Archives a MJPEG video or a JPEG snapshot. | ||
+ | |||
+ | Parameters: | ||
+ | * <tt>cam</tt>: the device # of the camera. | ||
+ | * <tt>duration</tt>: the duration, in seconds, of the video. The default value is 60 seconds. | ||
+ | * <tt>format</tt>: set it to '''1''' for snapshots. If this is missing or has any other value, the archive will be a MJPEG video. | ||
+ | |||
+ | |||
+ | Examples: | ||
+ | |||
+ | * Archive a snapshot: | ||
+ | http://ip_address:3480/data_request?id=archive_video&cam=8&format=1 | ||
+ | * Archive a 40 seconds video: | ||
+ | http://ip_address:3480/data_request?id=archive_video&cam=3&duration=40 | ||
==jobstatus== | ==jobstatus== | ||
+ | |||
+ | Returns the status of a job. The parameters are <tt>job</tt>, which is the job ID and optionally <tt>plugin</tt>, which is the plugin name. | ||
+ | {{Warning|For a Z-Wave job, the value of the <tt>plugin</tt> parameter must be ''zwave''.}} | ||
+ | If <tt>job</tt> is invalid the status returned is ''-1''. | ||
+ | |||
+ | This is the list with all job statuses and their meaning: | ||
+ | |||
+ | * '''-1''': No job, i.e. job doesn't exist. | ||
+ | * '''0''': Job waiting to start. | ||
+ | * '''1''': Job in progress. | ||
+ | * '''2''': Job error. | ||
+ | * '''3''': Job aborted. | ||
+ | * '''4''': Job done. | ||
+ | * '''5''': Job waiting for callback. Used in special cases. | ||
+ | * '''6''': Job requeue. If the job was aborted and needs to be started, use this special value. | ||
+ | * '''7''': Job in progress with pending data. This means the job is waiting for data, but can't take it now. | ||
+ | |||
+ | Examples: | ||
+ | |||
+ | http://ip_address:3480/data_request?id=jobstatus&job=13 | ||
+ | |||
+ | http://ip_address:3480/data_request?id=jobstatus&job=6&plugin=zwave | ||
==invoke== | ==invoke== | ||
+ | |||
+ | This request shows the list of devices and the actions they support through the UPnP services specified in their UPnP device description file. Only the actions with a star (*) preceding their name are implemented. | ||
+ | |||
+ | Examples: | ||
+ | * http://ip_address:3480/data_request?id=invoke | ||
+ | * http://ip_address:3480/data_request?id=invoke&DeviceNum=6 | ||
+ | * http://ip_address:3480/data_request?id=invoke&UDN=uuid:4d494342-5342-5645-0002-000000000002 | ||
+ | |||
+ | ==relay== | ||
+ | ''* UI5+ only'' | ||
+ | |||
+ | This tells the system to setup a relay so that you can access a device on the home network from outside the home. This is most commonly used to fetch streaming video from a camera, although it can actually be used for any IP device. This takes either an 'ip' or 'device' argument. If you pass a device, this is assumed to be a device ID, and the system will find the ip associated with that device. Optionally pass a port argument for the port you want to be relayed. Port 80 is assumed if none is specified. | ||
+ | |||
+ | This request will return a 'server:port' which you can use externally to access the designated device. The relay stays open for 15 minutes before closing, at which point you will need to open it again. | ||
+ | |||
+ | So, assume you have a NAS device on the home network with the ip 192.168.1.55 and the NAS runs a configuration web page on port 80. You could access it by doing this: | ||
+ | |||
+ | http://ip_address:3480/data_request?id=relay&ip=192.168.1.55&port=80 | ||
+ | |||
+ | and if the response is: "someserver:20202", then for 15 minutes, "http://someserver:20202" will be the NAS's configuration page. | ||
+ | |||
+ | If you want to access a camera, device #5, then do this: | ||
+ | |||
+ | http://ip_address:3480/data_request?id=relay&device=5 | ||
+ | |||
+ | and if the response is "someserver:20211" and if the 'DirectStreamURL' variable (or 'streaming' in sdata) is "video.mpeg", then for 15 minutes you can access the camera's video at: http://someserver:20211/video.mpeg | ||
+ | |||
+ | Note that if the device, the camera in this case, has http authentication, you will need to pass this too. So, if the user_data or sdata for the camera shows the user name is 'johndoe' and the password is 'john123', then you can view the video at: http://john:john123@someserver:20211/video.mpeg | ||
+ | |||
+ | IMPORTANT: For the 15 minutes while this relay is open, it will be open to anyone on the internet and public. Therefore, for security, you may want to add to the data_request the argument externalip=x where x is the routable, external IP, such as 70.182.172.111, of the device that will be accessing the port. This means that when the relay is open, a firewall will be set on the relay server so that incoming connections are only accepted from that ip address. | ||
+ | |||
+ | ==update_plugin== | ||
+ | ''* UI5+ only'' | ||
+ | |||
+ | Updates a plugin to the latest version. | ||
+ | |||
+ | Example: http://ip_address:3480/data_request?id=update_plugin&Plugin=Plugin_ID | ||
+ | |||
+ | |||
+ | == Accessing Vera remotely through the MiOS servers == | ||
+ | |||
+ | <span style="color:#ff0000; font-weight:bold; font-style:italic">* Obsolete on UI7</span> | ||
+ | |||
+ | The MiOS servers provide a secure way to remotely access and control your Vera system using the HTTP interface. Everything you can do locally with Vera on port 3480, you can do remotely with MiOS using the exact same syntax. You only need to pass the MiOS account username and password on the URL to the remote access server, along with the serial number of the unit (ie. 30012345). For example, the <tt>user_data</tt> request syntax over the Internet through the MiOS servers is: | ||
+ | |||
+ | [https://fwdX.mios.com/demovera/myvera123/30012345/data_request?id=user_data https://fwdX.mios.com/demovera/myvera123/30012345/data_request?id=user_data] | ||
+ | |||
+ | assuming ''demovera'' is the MiOS account username and ''myvera123'' is the password. '''Note that since the request is <tt>https</tt>, the username and password are encrypted because <tt>https</tt> encrypts the URL's as well as the contents of the page.''' | ||
+ | |||
+ | ==What to do when the HTTP request string is too long== | ||
+ | |||
+ | http://forum.micasaverde.com/index.php/topic,10170.msg69530.html#msg69530 |
Latest revision as of 13:52, 22 August 2017
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 the list of requests:
[edit] user_data
Example: http://ip_address:3480/data_request?id=user_data
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.
By default, the user_data is in JSON format, however, you can get it in XML format by adding the output_format=xml
parameter:
http://ip_address:3480/data_request?id=user_data&output_format=xml
If you don't care about the static data, which is the information from the device json files (e.g. D_BinaryLight1.json) which appears in the static_data object, then you can add the ns=1
parameter:
http://ip_address:3480/data_request?id=user_data&output_format=xml&ns=1
[edit] status
This returns the current status for all devices including all the current UPnP variables and the status of any active jobs.
Examples:
Or for a specific device:
- http://ip_address:3480/data_request?id=status&output_format=xml&UDN=uuid:4d494342-5342-5645-0002-000000000002
- http://ip_address:3480/data_request?id=status&output_format=xml&DeviceNum=6
[edit] sdata
This is an abbreviated form of user_data and status (sdata = summary data). It allows a user interface that is only worried about control, and not detailed configuration, to get a summary of the data that would normally be presented to the user and to monitor the changes. See UI_Simple for a walkthrough.
Examples:
- http://ip_address:3480/data_request?id=sdata
- http://ip_address:3480/data_request?id=sdata&output_format=xml
[edit] actions
[edit] device
Example: http://ip_address:3480/data_request?id=device&action=rename&device=5&name=Chandalier&room=3
Example: http://ip_address:3480/data_request?id=device&action=rename&device=5&name=Chandalier&room=Garage
Example: http://ip_address: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 passing either the ID or the name.
---old--- This returns all the XML with all the UPNP device description documents. Use: http://ip_address: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://ip_address:3480/luvd/S_HVAC_UserOperatingMode1.xml ---end old---
[edit] scene
Example: http://ip_address:3480/data_request?id=scene&action=record
Example: http://ip_address:3480/data_request?id=scene&action=pause&seconds=y
Example: http://ip_address:3480/data_request?id=scene&action=stoprecord
Example: http://ip_address:3480/data_request?id=scene&action=listrecord
Example: http://ip_address:3480/data_request?id=scene&action=deleterecord&number=x
Example: http://ip_address:3480/data_request?id=scene&action=saverecord&name=whatever&room=X
Example: http://ip_address:3480/data_request?id=scene&action=rename&scene=5&name=Chandalier&room=Garage
Example: http://ip_address:3480/data_request?id=scene&action=delete&scene=5
Example: http://ip_address:3480/data_request?id=scene&action=create&json=[valid json data]
Example: http://ip_address:3480/data_request?id=scene&action=list&scene=5
This creates, renames, or deletes a scene depending on the action.
Recording a scene means whatever actions come in after sending the 'record' will be saved into an internal buffer. listrecord shows what's recorded so far. pause adds a pause. deleterecord deletes some action in the internal buffer. When deleting, for number=x, use the same 'id' in listrecord. saverecord takes the internal buffer, the recorded macro, and saves it as an actual scene.
To create a scene by hand, rather than recording it, use 'create'. When using the 'create' command json must be valid JSON for a scene as documented in Scene_Syntax. The name, room and optional id (if you're overwriting an existing scene) are passed in the json, so nothing is on the command line except the json. Because the json data can be long it is recommended to send it as an http POST instead of GET with the data passed with the name "json"
list returns the JSON data for an existing scene.
[edit] room
Example: http://ip_address:3480/data_request?id=room&action=create&name=Kitchen
Example: http://ip_address:3480/data_request?id=room&action=rename&room=5&name=Garage
Example: http://ip_address:3480/data_request?id=room&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.
[edit] file
Returns the contents of a file in /etc/cmh or /etc/cmh-ludl. Has one parameter, parameters, which is the name of the file.
Example: http://ip_address:3480/data_request?id=file¶meters=D_BinaryLight1.xml
[edit] lua
[edit] action
Sends a UPnP action.
- To call the action for a single device, use
DeviceNum
. - To call the action for all devices in the same category, use
Category
.
Examples:
- Turn off a light:
- Set a dimmable light to 30%:
- Run a scene:
- Install a plugin:
- Turn off all lights:
- Arm all sensors:
Category 999 is a virtual category which encompasses all devices in category 2 (dimmable lights) and 3 (binary lights). |
[edit] variableset
If you leave off the DeviceNum and serviceID, then this sets a top-level json tag called "Variable" with the value.
[edit] variableget
If you leave off the DeviceNum and serviceID, then this gets a top-level json tag called "Variable".
[edit] reload
Resets the Luup engine with any new configuration settings.
Example: http://ip_address:3480/data_request?id=reload
[edit] alive
Return OK if the engine is running.
[edit] finddevice
Returns the device number, UDN and device type of the first device that matches any or all the parameters passed on the URL: devtype, ip, devid, where devid is the altid of the device. Or instead of devid, pass devnum and it will find the device with that number.
Example: http://ip_address:3480/data_request?id=finddevice&devid=6
[edit] resync
ReSync's all the devices, rooms, users, sections with event servers and returns OK
[edit] 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.
[edit] 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 timeout to specify the oldest IP request in seconds.
Examples:
- This returns the devices which showed up on the network in the past hour:
http://ip_address:3480/data_request?id=iprequests&timeout=3600
- This returns the devices which showed up on the network in the last 24 hours:
http://ip_address:3480/data_request?id=iprequests&timeout=86400
[edit] 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.
Not implemented yet!
[edit] live_energy_usage
For backward compatibility, it reports the current energy usage in a tab delimited format.
Example: http://ip_address:3480/data_request?id=live_energy_usage
Device # Name Room Category Watts 59 Basement Light Basement 3 20 60 Bedroom Light 1st Floor 3 0 61 Porch Light Outside 3 30
To display only the watts variable : http://ip_address:3480/data_request?id=variableget&DeviceNum=34&serviceId=urn:micasaverde-com:serviceId:EnergyMetering1&Variable=Watts and you must specify the device id for the variable and the service id.
[edit] request_image
Returns an image from a camera. This fetches the image from the camera using the URL variable for the device. Pass arguments:
cam = the device id of the camera. This is the only mandatory argument. res = optional: a resolution, which gets appended to the variable. So passing "low" means the image from the URL_low variable will be returned. If it doesn't exist it reverts to the standard URL or DirectStreamingURL timeout = optional: how long to wait for the image to be retrieved, or how long to retrieve video. defaults to 10 seconds. url = optional: override the camera's default URL ip = optional: override the camera's default ip user or pass = optional: override the camera's default username/password
[edit] archive_video
* UI5+ only
Archives a MJPEG video or a JPEG snapshot.
Parameters:
- cam: the device # of the camera.
- duration: the duration, in seconds, of the video. The default value is 60 seconds.
- format: set it to 1 for snapshots. If this is missing or has any other value, the archive will be a MJPEG video.
Examples:
- Archive a snapshot:
http://ip_address:3480/data_request?id=archive_video&cam=8&format=1
- Archive a 40 seconds video:
http://ip_address:3480/data_request?id=archive_video&cam=3&duration=40
[edit] jobstatus
Returns the status of a job. The parameters are job, which is the job ID and optionally plugin, which is the plugin name.
For a Z-Wave job, the value of the plugin parameter must be zwave. |
If job is invalid the status returned is -1.
This is the list with all job statuses and their meaning:
- -1: No job, i.e. job doesn't exist.
- 0: Job waiting to start.
- 1: Job in progress.
- 2: Job error.
- 3: Job aborted.
- 4: Job done.
- 5: Job waiting for callback. Used in special cases.
- 6: Job requeue. If the job was aborted and needs to be started, use this special value.
- 7: Job in progress with pending data. This means the job is waiting for data, but can't take it now.
Examples:
http://ip_address:3480/data_request?id=jobstatus&job=13
http://ip_address:3480/data_request?id=jobstatus&job=6&plugin=zwave
[edit] invoke
This request shows the list of devices and the actions they support through the UPnP services specified in their UPnP device description file. Only the actions with a star (*) preceding their name are implemented.
Examples:
- http://ip_address:3480/data_request?id=invoke
- http://ip_address:3480/data_request?id=invoke&DeviceNum=6
- http://ip_address:3480/data_request?id=invoke&UDN=uuid:4d494342-5342-5645-0002-000000000002
[edit] relay
* UI5+ only
This tells the system to setup a relay so that you can access a device on the home network from outside the home. This is most commonly used to fetch streaming video from a camera, although it can actually be used for any IP device. This takes either an 'ip' or 'device' argument. If you pass a device, this is assumed to be a device ID, and the system will find the ip associated with that device. Optionally pass a port argument for the port you want to be relayed. Port 80 is assumed if none is specified.
This request will return a 'server:port' which you can use externally to access the designated device. The relay stays open for 15 minutes before closing, at which point you will need to open it again.
So, assume you have a NAS device on the home network with the ip 192.168.1.55 and the NAS runs a configuration web page on port 80. You could access it by doing this:
http://ip_address:3480/data_request?id=relay&ip=192.168.1.55&port=80
and if the response is: "someserver:20202", then for 15 minutes, "http://someserver:20202" will be the NAS's configuration page.
If you want to access a camera, device #5, then do this:
http://ip_address:3480/data_request?id=relay&device=5
and if the response is "someserver:20211" and if the 'DirectStreamURL' variable (or 'streaming' in sdata) is "video.mpeg", then for 15 minutes you can access the camera's video at: http://someserver:20211/video.mpeg
Note that if the device, the camera in this case, has http authentication, you will need to pass this too. So, if the user_data or sdata for the camera shows the user name is 'johndoe' and the password is 'john123', then you can view the video at: http://john:john123@someserver:20211/video.mpeg
IMPORTANT: For the 15 minutes while this relay is open, it will be open to anyone on the internet and public. Therefore, for security, you may want to add to the data_request the argument externalip=x where x is the routable, external IP, such as 70.182.172.111, of the device that will be accessing the port. This means that when the relay is open, a firewall will be set on the relay server so that incoming connections are only accepted from that ip address.
[edit] update_plugin
* UI5+ only
Updates a plugin to the latest version.
Example: http://ip_address:3480/data_request?id=update_plugin&Plugin=Plugin_ID
[edit] Accessing Vera remotely through the MiOS servers
* Obsolete on UI7
The MiOS servers provide a secure way to remotely access and control your Vera system using the HTTP interface. Everything you can do locally with Vera on port 3480, you can do remotely with MiOS using the exact same syntax. You only need to pass the MiOS account username and password on the URL to the remote access server, along with the serial number of the unit (ie. 30012345). For example, the user_data request syntax over the Internet through the MiOS servers is:
https://fwdX.mios.com/demovera/myvera123/30012345/data_request?id=user_data
assuming demovera is the MiOS account username and myvera123 is the password. Note that since the request is https, the username and password are encrypted because https encrypts the URL's as well as the contents of the page.
[edit] What to do when the HTTP request string is too long
http://forum.micasaverde.com/index.php/topic,10170.msg69530.html#msg69530