Transition from httpd2 to Restful API

Posted on
Fri Sep 30, 2022 9:28 am
DVDDave offline
Posts: 470
Joined: Feb 26, 2006
Location: San Jose, CA

Transition from httpd2 to Restful API

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

Posted on
Fri Sep 30, 2022 11:06 am
jay (support) offline
Site Admin
User avatar
Posts: 18219
Joined: Mar 19, 2008
Location: Austin, Texas

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.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Sep 30, 2022 1:39 pm
DVDDave offline
Posts: 470
Joined: Feb 26, 2006
Location: San Jose, CA

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'' ... =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

Posted on
Sat Oct 01, 2022 11:12 am
jay (support) offline
Site Admin
User avatar
Posts: 18219
Joined: Mar 19, 2008
Location: Austin, Texas

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.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sat Oct 01, 2022 1:22 pm
DVDDave offline
Posts: 470
Joined: Feb 26, 2006
Location: San Jose, CA

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.

Posted on
Sat Oct 01, 2022 4:08 pm
DVDDave offline
Posts: 470
Joined: Feb 26, 2006
Location: San Jose, CA

Re: Transition from httpd2 to Restful API

jay (support) wrote:
You couldn't use that with the REST API anyway - it doesn't match what the API requires...

Jay,

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%20on
I could specify
Code: Select all
 /devices/thermostat?_method=put&
as the path required by the Ambient API.
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

Posted on
Sat Oct 01, 2022 8:55 pm
DVDDave offline
Posts: 470
Joined: Feb 26, 2006
Location: San Jose, CA

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.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest

cron