Since the httpd2 plugin has been discontinued and is locking up periodically, I'm trying to change over to the builtin Restful API for use with my Ambient weather station.
The awnet app for Ambient allows me to set a port and base URL so I've been using /setvar? with httpd2 and it's been working well (except for the lockup problem). However, this doesn't work for Restful. Is there an equivalent base URL that would work to either set variables or device states?
Thanks!
--Dave
Transition from httpd2 to Restful API
- jay (support)
- Site Admin
- Posts: 19232
- Joined: Wed Mar 19, 2008 11:52 am
- Location: Austin, Texas
- Contact:
Re: Transition from httpd2 to Restful API
Don't use the REST API - we may deprecate it in the next release. Unfortunately, we're not far enough along to outline to everyone what the replacement will be.
What is the exact format of the URL that Ambient needs to use (details please)? Maybe we can help with a different solution.
What is the exact format of the URL that Ambient needs to use (details please)? Maybe we can help with a different solution.
Re: Transition from httpd2 to Restful API
Ah, thanks for the warning, Jay. I saw the note about a future change to the API, but I was trying start the transition with the existing API after reading Joe's advise to "use the reflector instead". I may have misunderstood that statement
To answer your question, the weather station sends a url that looks like:
http://'indigo_server_ip':'port''path''param1=value1'&'param2=value2'...
I can specify indigo_server_ip, port, and path as well as the frequency updates are sent.
With the httpd 2 plugin, I set the path to /setvar? which works great with the plugin to set the httpd 2 device attributes. However, when I try to use the various forms of the Restful API, I butt up against the problem that it requires text at the end of the url to specify the method. There is no way the weather station's protocol supports this.
The station can also use the WeatherUnderground protocol defined in https://support.weather.com/s/article/P ... uage=en_US. However, this seems a lot more complicated and I haven't been able to decipher it yet.
Thanks.
--Dave
To answer your question, the weather station sends a url that looks like:
http://'indigo_server_ip':'port''path''param1=value1'&'param2=value2'...
I can specify indigo_server_ip, port, and path as well as the frequency updates are sent.
With the httpd 2 plugin, I set the path to /setvar? which works great with the plugin to set the httpd 2 device attributes. However, when I try to use the various forms of the Restful API, I butt up against the problem that it requires text at the end of the url to specify the method. There is no way the weather station's protocol supports this.
The station can also use the WeatherUnderground protocol defined in https://support.weather.com/s/article/P ... uage=en_US. However, this seems a lot more complicated and I haven't been able to decipher it yet.
Thanks.
--Dave
- jay (support)
- Site Admin
- Posts: 19232
- Joined: Wed Mar 19, 2008 11:52 am
- Location: Austin, Texas
- Contact:
Re: Transition from httpd2 to Restful API
You couldn't use that with the REST API anyway - it doesn't match what the API requires.
You do need something that will catch that URL and do something with it.
You do need something that will catch that URL and do something with it.
Re: Transition from httpd2 to Restful API
Yeah, that's what I figured. I'll guess I need to dig deeper or hope that the httpd 2 plugin starts working more reliably since nobody seems to have figured out what's wrong with it and the Rest API is not an adequate substitute in all cases. Thanks, Jay.
Re: Transition from httpd2 to Restful API
Jay,jay (support) wrote:You couldn't use that with the REST API anyway - it doesn't match what the API requires...
Looking at the current REST API more carefully, I should be able to use this format taken from the examples in your docs:
Code: Select all
http://127.0.0.1:8176/devices/thermostat?_method=put&hvacCurrentMode=auto%20onCode: Select all
/devices/thermostat?_method=put&However, I've been trying to change the device properties by manually issuing a URL with no success. I can do it for variables but not devices. A page of data such as name, type, etc is returned but no properties and the referenced property (eg hvacCurrentMode) is not changed. Any idea why the properties are not shown or changed for the device?
--Dave
Re: Transition from httpd2 to Restful API
Whoops, never mind. I found a forum message where you clarified that the examples you provide in the Wiki only work to change the property values of certain types of devices.