MSR API functions and documentation
-
Hi
I am assuming in time MSR will have some API documentation.
I am going to ask Bill the developer of the Home Remote dashboard app if he can add support for MSR.
Specifically support for MSR global Reactions (Scenes), where hopefully they can be imported in to the Home Remote Designer application and then we can more easily create dashboard tiles that when pressed would run a particular MSR global Reaction etc.
Currently in Home Remote it's possible but not so easy to create a tile that runs a http request when pressed and I have tested this and it does work and will run an MSR global Reaction.
But I'd much prefer if in the Home Remote Designer application MSR could be added as a device type and then all its global Reactions
imported as it does with Vera and other systems. -
I seem to recall Patrick declaring his intention to make this very thing happen down the road. In the meantime, there's just a ton of documentation needing doing for the existing functionality, UI and workflows, not to mention the vast and growing
lexpjs
lexicon from which Expressions derive. I wonder sometimes how the man finds the time to get it all done, and so swiftly! (Says he who probably filed twice as many PRs - not all of them valid - as any beta tester!)I vote +1 for your request, but I also secretly hold out hope that I'll use MSR's own built-in Dashboard as my primary instead of outsourcing that function to Home Remote (awesome as it is!).
-
I seem to recall Patrick declaring his intention to make this very thing happen down the road. In the meantime, there's just a ton of documentation needing doing for the existing functionality, UI and workflows, not to mention the vast and growing
lexpjs
lexicon from which Expressions derive. I wonder sometimes how the man finds the time to get it all done, and so swiftly! (Says he who probably filed twice as many PRs - not all of them valid - as any beta tester!)I vote +1 for your request, but I also secretly hold out hope that I'll use MSR's own built-in Dashboard as my primary instead of outsourcing that function to Home Remote (awesome as it is!).
-
@toggledbits Are there any currently-documented HTTP calls we can make against MSR?
As in GET requests of this type or similar...
http://<msr_platform_ip>:8111/action/set?<var_name>=<var_value>
I'd love to be able to send data directly to MSR in certain circumstances, rather than filter them through an artificial construct like a Virtual Sensor on Vera.
-
NOTE: API DOCUMENTATION HAS BEEN MOVED HERE. THE DOCUMENTATION BELOW IS NOW OUTDATED.
Yes... another thing that needs documentation, but also somewhat in flux, and incomplete. The HTTP API is little-used, but I've tried to keep up some parity with the WebSocket API, which is what the UI uses exclusively.
All HTTP APIs are accessible at the service IP and port beneath the
/api/v1/
path (i.e.http://192.168.0.10:8111/api/v1/alive
). All charset encoding is UTF-8. There is no security/authorization currently, but this is expected to change.alive
- (GET) returns a fixed response UUID together with the IP address of the requestor; any error would indicate that MSR is not running/healthy.structure
- (GET) returns a JSON response containing the Structure instance, all controllers, and all entities.capabilities
- (GET) returns the currently-known information for a registered capabilitycapability/:id
- (GET) returns the information for the specified (id) capabilitycontroller/:id
- (GET) returns the information for the specified (id) controller instanceentity/:id
- (GET) returns the current state of the specified entity (canonical id) instanceentity/:id/attribute/:attr
- (GET) returns the attribute value of the specified attribute (capability + attribute name in attr) for the specified entity (id)entity/:id/attribute/:attr/set
- (GET, POST) sets the attribute value to that in the "value" query parameter (when POST is used, the request body type must be application/x-www-form-urlencoded)entity/:id/perform/:action
- (GET, POST) performs the named action (capability + action name form) on the specified entity; query parameters are the action arguments, if any (when POST is used, the request body type must be application/x-www-form-urlencoded)reaction/:id
- (GET) return data for the specified global reactionreaction/:id/run
- (GET) run the specified global reactionreaction/:id/stop
- (GET) stop the specified global reaction if it is runningreaction/:id/enable
- (GET) enable the specified global reactionreaction/:id/disable
- (GET) enable the specified global reactionrulesets
- (GET) return the system rule sets and their rulesvariables
- (GET) return the global variable definedvariable/:name
- (GET) return definition and current value for the named global variablevariable/:name/set
- (PUT) set the global variable specified to a value (JSON data); the request body must be application/json type. -
NOTE: API DOCUMENTATION HAS BEEN MOVED HERE. THE DOCUMENTATION BELOW IS NOW OUTDATED.
Yes... another thing that needs documentation, but also somewhat in flux, and incomplete. The HTTP API is little-used, but I've tried to keep up some parity with the WebSocket API, which is what the UI uses exclusively.
All HTTP APIs are accessible at the service IP and port beneath the
/api/v1/
path (i.e.http://192.168.0.10:8111/api/v1/alive
). All charset encoding is UTF-8. There is no security/authorization currently, but this is expected to change.alive
- (GET) returns a fixed response UUID together with the IP address of the requestor; any error would indicate that MSR is not running/healthy.structure
- (GET) returns a JSON response containing the Structure instance, all controllers, and all entities.capabilities
- (GET) returns the currently-known information for a registered capabilitycapability/:id
- (GET) returns the information for the specified (id) capabilitycontroller/:id
- (GET) returns the information for the specified (id) controller instanceentity/:id
- (GET) returns the current state of the specified entity (canonical id) instanceentity/:id/attribute/:attr
- (GET) returns the attribute value of the specified attribute (capability + attribute name in attr) for the specified entity (id)entity/:id/attribute/:attr/set
- (GET, POST) sets the attribute value to that in the "value" query parameter (when POST is used, the request body type must be application/x-www-form-urlencoded)entity/:id/perform/:action
- (GET, POST) performs the named action (capability + action name form) on the specified entity; query parameters are the action arguments, if any (when POST is used, the request body type must be application/x-www-form-urlencoded)reaction/:id
- (GET) return data for the specified global reactionreaction/:id/run
- (GET) run the specified global reactionreaction/:id/stop
- (GET) stop the specified global reaction if it is runningreaction/:id/enable
- (GET) enable the specified global reactionreaction/:id/disable
- (GET) enable the specified global reactionrulesets
- (GET) return the system rule sets and their rulesvariables
- (GET) return the global variable definedvariable/:name
- (GET) return definition and current value for the named global variablevariable/:name/set
- (PUT) set the global variable specified to a value (JSON data); the request body must be application/json type.@toggledbits said in MSR API functions and documentation:
entity/:id/perform/:action - (GET, POST) performs the named action (capability + action name form) on the specified entity; query parameters are the action arguments, if any (when POST is used, the request body type must be application/x-www-form-urlencoded)
Just trying this, I was able to get a Z-Wave appliance plug to turn ON / OFF with a simple one line HTTP command !
http://MSR-IP:8111/api/v1/entity/vera>device_50/perform/power_switch.on
http://MSR-IP:8111/api/v1/entity/vera>device_50/perform/power_switch.off
Don't really have a need for this though as Vera's own HTTP API (Luup Requests) is also pretty simple to use.
However the new Ezlo HTTP API is not so easy to use.
Maybe in the future if MSR does support and integrate with Ezlo hubs, we could use MSR's own HTTP API for controlling devices on the Ezlo hub, instead of actually using Ezlo's own HTTP API directly.
-
NOTE: API DOCUMENTATION HAS BEEN MOVED HERE. THE DOCUMENTATION BELOW IS NOW OUTDATED.
Yes... another thing that needs documentation, but also somewhat in flux, and incomplete. The HTTP API is little-used, but I've tried to keep up some parity with the WebSocket API, which is what the UI uses exclusively.
All HTTP APIs are accessible at the service IP and port beneath the
/api/v1/
path (i.e.http://192.168.0.10:8111/api/v1/alive
). All charset encoding is UTF-8. There is no security/authorization currently, but this is expected to change.alive
- (GET) returns a fixed response UUID together with the IP address of the requestor; any error would indicate that MSR is not running/healthy.structure
- (GET) returns a JSON response containing the Structure instance, all controllers, and all entities.capabilities
- (GET) returns the currently-known information for a registered capabilitycapability/:id
- (GET) returns the information for the specified (id) capabilitycontroller/:id
- (GET) returns the information for the specified (id) controller instanceentity/:id
- (GET) returns the current state of the specified entity (canonical id) instanceentity/:id/attribute/:attr
- (GET) returns the attribute value of the specified attribute (capability + attribute name in attr) for the specified entity (id)entity/:id/attribute/:attr/set
- (GET, POST) sets the attribute value to that in the "value" query parameter (when POST is used, the request body type must be application/x-www-form-urlencoded)entity/:id/perform/:action
- (GET, POST) performs the named action (capability + action name form) on the specified entity; query parameters are the action arguments, if any (when POST is used, the request body type must be application/x-www-form-urlencoded)reaction/:id
- (GET) return data for the specified global reactionreaction/:id/run
- (GET) run the specified global reactionreaction/:id/stop
- (GET) stop the specified global reaction if it is runningreaction/:id/enable
- (GET) enable the specified global reactionreaction/:id/disable
- (GET) enable the specified global reactionrulesets
- (GET) return the system rule sets and their rulesvariables
- (GET) return the global variable definedvariable/:name
- (GET) return definition and current value for the named global variablevariable/:name/set
- (PUT) set the global variable specified to a value (JSON data); the request body must be application/json type.@toggledbits said in MSR API functions and documentation:
variable/:name/set - (PUT) set the global variable specified to a value (JSON data); the request body must be application/json type.
Please can we have a GET for this one rather than PUT ?
I would like a simple one line HTTP command to set the value of a Global Expression.
This could then be used to manually trigger Rule Sets, that are using that Global Expression as a trigger and monitoring for a particular value being set in that expression etc.
I could then create some MSR Rule Sets that act as "Scenes" and manually trigger / run them by sending in a HTTP request to MSR from the Home Remote dashboard app and a button.
Thanks
-
MSR Health Check:
http://MSR-IP:8111/api/v1/alive
Any ideas how I can have a device in Vera that checks the health of MSR if its up or down etc ?
If I enter this URL in a browser I get a response like this:
fbd1234c-5fdc-11fg-9093-3798dc850621 Hello 192.168.0.101
That IP is my laptop's IP address.
If I stop MSR from running and run the URL again then obvious I then get no response back from MSR.
Or maybe I could just use the WOL with Ping plugin for Vera and ping the Raspberry Pi itself, think I already have the plugin installed.
-
The
WOL with Ping
plug-in should suffice for your purposes; the other logical alternative would be Rigpapa's awesomeSite Sensor
plug-in, which checks a specified URL on a schedule and parses the response into JSON. Because it can handle multiple instances/children peeking at different URLs, you could conceivably have Vera react to more than just "Is MSR awake?" events. -
NOTE: API DOCUMENTATION HAS BEEN MOVED HERE. THE DOCUMENTATION IN THIS THREAD IS NOW OUTDATED.
-
T toggledbits locked this topic on
-
T toggledbits unlocked this topic on
-
T toggledbits locked this topic on