Add support for Ambient Weather variant#174
Add support for Ambient Weather variant#174PhracturedBlue wants to merge 1 commit intohome-assistant-libs:mainfrom
Conversation
|
@joostlek, this one should be verified with some documentation on the "AmbientWeather" protocol. It would be a nice to have, and would likely make happy a lot of Ambient Weather station owners, as I remember it doesn't have a local option in HA, but from the Ambient Weather site. (And some quirky solutions, as I read in this thread https://community.home-assistant.io/t/ambient-weather-available-locally-now-integration-anyone/299180 @PhracturedBlue, could you provide some documentation on this? Logs, settings to activate the protocol. And any info if there is any PR to core to implement in HA. (That would need a documentation update as well.) I am not fully convinced that this is just a minor change. |
|
The only changes in homeassistant are: Other than that is just works. In the ambient weather app, I just paste the webhook url as: And everything works I can't really file a PR for HASS until this change is accepted, since I need to update the proper version of aioecowitt. The aioecowitt module doesn't seem to have any documentation, but I can file a PR for Hass documentation as well. But again, it makes little sense to to do util I've filed the HASS PR, which is gated by getting the changes into this module. |
|
@PhracturedBlue, I will test your PR with an Ecowitt station for backward compatibility and will make a custom component of ecowitt with the rest of your suggested changes to test it with other Ambient Weather owners as well. It looks good to me, but need some confirmation, that it would work with both. Otherwise, can you implement the Also, can you verify, that everything is correct according this API documentation? https://github.com/ambient-weather/api-docs/wiki/Device-Data-Specs#data-timing |
It requires an additional
Otherwise it fails with an error message. @PhracturedBlue, would you mind to try this as a full proof of concept for Ambient Weather? |
|
I had to upgrade to the latest home-assistant, but it seems to be working fine. |
|
Do you have low battery indicator binary entities? Are those correct? |
How Ambient Weather calls your device? I assume you have an external device with PM, CO2 and whatever else. It is a WH45 in Ecowitt, but what is it for Ambient? I think your WH45 Battery was showing 1 or 100% before. But really it is a low battery indicator with the value 1 as full and 0 as low. But the Ecowitt custom component interprets it wrongly. I have not cross checked how it was working with Ecowitt devices. But I know this already, a guy reported the same on the community forum. So thanks for confirming. |
|
right, I don't have an external device (or maybe more recent base-stations have it built in). |
I think, either the base station reports it by default even without a sensor (obviously wrongly), or it is reporting |
|
I agree. From my perspective your changes work well (and better than any of the alteratives I've tried). If you file a PR for the ecowitt chages in HA, I can file a PR for updating the documentation with how to setup an AmbientWeather device with it. |
|
It is not that easy. Because the Ambient Weather Local should be a virtual integration, which I am not sure how to set up. As I have never looked at that option for an integration before. |
|
I don't follow. The currently recommended 'Ambient Weather' integration is to use the cloud. Why is any more needed than to just document that the ecowitt integration is also capable of doing AmbientWeather local (rather than trying to make it THE official way of doing so)? |
|
@PhracturedBlue, could you please confirm how many batteries you have? And paste here the I assume you have |
|
The Windchill is as expected. It is provided as the wind blows, if it is less than something, it is not even provided, so in HA goes unavailable. I've opened an issue with Ambient Weather to get a clarification on the |
|
@PhracturedBlue, could you check this? |
|
I upgraded to v4.3.6 which is the latest available firmware for my rather old device (original WS-2902 from 2017). I still have batt_co2: |
| else: | ||
| if request.method != "POST": | ||
| return web.Response(status=405) | ||
| if self.path is not None and request.path != self.path: | ||
| return web.Response(status=404) | ||
| data = await request.post() |
There was a problem hiding this comment.
| else: | |
| if request.method != "POST": | |
| return web.Response(status=405) | |
| if self.path is not None and request.path != self.path: | |
| return web.Response(status=404) | |
| data = await request.post() | |
| elif request.method != "POST": | |
| return web.Response(status=405) | |
| elif self.path is not None and request.path != self.path: | |
| return web.Response(status=404) | |
| else: | |
| # regular POST request | |
| data = await request.post() |
| return web.Response(status=404) | ||
| data = await request.post() | ||
| if request.method == "GET": | ||
| # Ambient Weather variant |
There was a problem hiding this comment.
explain in the comment that this device is not doing a post request but a get
| station = data.pop("stationtype") | ||
| passkey = data.pop("PASSKEY") | ||
| model = data.pop("model") | ||
| model = data.pop("model", None) |
There was a problem hiding this comment.
Maybe set something like "UNKNOWN" as default value for the model ?


AmbientWeather and Ecowitt use nearly identical protocols. Ecowitt uses a POST form, whereas AmbientWeather sends all data as params with a GET request.
The only other differences I found with my WS2902 was it sends 'batt_co2' instead of 'co2_batt' (even though it doesn't have any co2 sensor)
This plus a small home-asistant patch enabling 'GET' in the webhook were the only changes I needed to get my weather station working with HASS.