[PROJECT] Driver for Ambient API/Local and Ecowitt

I wanted to make a driver for my Hubitat. That is it really. I heard about this cool HA controller that could let your do your OWN STUFF. I had been wanting to do 2 things for a long time with the HA I already had:

  1. Monitor my aquarium controller's status page and turn on lights/something to warn if something is going bad.
  2. Monitor my weather station and turn off all my wife/kids' inflatables during Christmas if the wind got too strong.

Thus was born my Neptune Systems Apex driver and my Ambient Weather driver. I knew NOTHING about groovy before hand and I will not claim to be the least bit of an expert now, but I get some stuff working. Since then I added in drivers for Securifi stuff, WeatherFlow, Tesla PowerWall, and more...

You're doing well with it. In a prior life I was a COBOL programmer and really enjoyed it. May give Groovy a try soon. Thanks for what you're doing and for sharing it.

Hi there!

Iā€™m new to this and just got my Ambient Weather console (WS-50). I have installed the driver and the child driver. I have the API let (mine) and the MAC address input and it seems to be talking correctly. I bought 2 external sensors as the initial reason for buying this was to monitor the temps in my pool and hot tub. Iā€™m only getting temp and humidity as ā€œcurrent statesā€ from the driver and only one child device is showing up. Iā€™m pretty savvy, but I canā€™t seem to get this working the way it seems like it is supposed to. Could someone help? (I have ā€œenable child devicesā€ in the parent driver and expected my sensors to show up as individual devices as other drivers like this do, but thatā€™s not happening so I must have done something wrong!). Help!? :slight_smile:

I'm using the WS-2902A with the Ecowitt GW-1000 Gateway so I don't have any experience with the WS-50. Wish I could help, but I'm sure someone else will chime in soon.

Your pool sensor is the one not showing up, correct? I have not found any that report back from the API or via a gateway yet. But maybe we will get lucky and yours is the first.
First: What type of external sensors are they?
Second: If you could, please set the driver to "Trace" logging before an API Refresh, open the Logs window (generally as a second browser tab) and capture the log information from the Refresh to send to me (post here, or as a private message). Then you will want to set the Logging level back to something more reasonable.

The discussion in Coding Parent and Child in the Same Driver is very pertinent to this thread. Anyone else have concerns that coding Parent & Child devices in the same driver might lead to problems after a future platform update? I would like to see a resolution now to avoid a future problem.

Not sure how relevant it is, because I keep the child and parent drivers separate (not that I have had child devices in my drivers for long) and had no intention in combining them. I still let users create a single device without using children.

I am adding Air Quality Index (AQI) into the data for the parent, and on the PM2.5 sensor as a value (where possible), String, and Color. Questions for anyone with a PM2.5 sensor (or that wants to answer):

  1. Would you prefer a preference that allows you to select your region (as I add support for different methods of AQI) OR would you prefer the driver determine it based on your TimeZone and just do the best I can based on that? Benefit of region is that it is easier for me (although I already did a LOT of work on the time zone method before thinking to ask) and you can select a different region if you want a different method of calculating AQI. Negative it is another preference you need to set if the default ("United States") does not work for you. Benefit of time zone is that it will be automatic for the end user based on the time zone their hub is set for. Negative is that you cannot change it in the driver (since it is based on the hub).
  2. For the AQI color... how would you folks want that represented? The options I see are "words" or RGB value. I was making words... but RGB might be easier to use for other areas of code but not as easily human readable.

No answers yet... so I am not sure if that means almost nobody has a PM2.5, or just does not care, or almost everyone with an Ecowitt is over using @anon81541053's. :slight_smile:

In any case, in preparation for it I have posted a new child driver. Version 0.8.0 has the basic attributes for the AQI feature as well as some other minor changes. You do NOT need it yet at this time, but in case anyone noticed I wanted you to know it is OK to use (I use the same child driver for the WeatherFlow driver and it needed an attribute).

I am only worried about the countries people might be in for mine (not state differences). I have the US one all ready, and simple ones like the UK & Australia and such... so I will do those. Just the formula for AQI is not easy to find for most. Even though I put a lot of work into figuring out people's country by hub timezone... I am leaning towards just letting them select their region by a dropdown in preferences.

I don't currently have a PM2.5 -very happy with your other drivers which I am using.

My own preference for your region question would be to use the Hub setting for time zone to automatically set the region, but selecting from a pulldown is not a problem and probably much less of a headache for you.

Works for me. I did a bunch of countries via time zone... Just need to work on Asia a bit mostly. Thanks!

Is the ECOWITT WH0290 Air Quality Monitor PM2.5 Detector for sale anywhere without the panel display (both sell for $65.99 on Amazon)?

The WH41 for $47.99 on Amazon seems to be what I'm looking for.

I got one but it had a display with it. I just set the display aside because I have no plans to use it. They have the WH41 which is indoor/outdoor and then the indoor-only WH43.

Try as I might, I cannot get this driver to work. I have been trying off and on for months now trying both the older .99 and latest .69 versions. I have multiple API keys with Ambient but none work.

I have tested my API keys with Postman and they successfully return a 200 response code. I also am using a key successfully with pvoutput.org; no issues. Try as I might, these drivers only respond with 401 errors. As far as I can tell, these are authentication errors.

What is throwing me is that the driver refers to an AppKey and APIKey. On the Ambient site, I can generate and APIKey but it is unclear how the AppKey is generated. I also can't seem to delete and APIKey. The driver references and AppKey but I don't see any place to enter one.

I must be missing something obvious. Any help is appreciated. Thank you in advance!

The driver you would want to use is the AmbientEcowittWeather one, version 0.6.9 (so you had the right one there).

There are 3 required pieces of information if you are using the Ambient API (yes, you probably did them but I am just walking through the steps), and 5 steps:

  1. You need to select the Ambient API for the Weather Method preference.
  2. Save Preferences.
  3. Enter the MAC Address of your station, something along the lines of DC:4F:22:xx:xx:xx. (if you need to check somewhere for it, you can find it at https://ambientweather.net/devices)
  4. Enter your Personal API Key (if you do not have an application key, it will be the only one listed for your account https://ambientweather.net/account), otherwise, pick the one that is NOT listed as an application key.
  5. Save Preferences.

From this point it should be working. You can set the refresh interval to Manual if you want to refresh it yourself right then, or to 5 minutes or whatever you want otherwise.

You should only EVER need to use the APIKey, not the APPKey. That is for app developers (like me). There is one hard coded into the driver that proves to Ambient that it is "my" app people are using. If it became REALLY popular they could come back to me and say I need to do something, but that is unlikely. I mention the APPKey in the driver because if you ever make your own version of the driver, you should replace the one I have in there with one you get yourself.

If for some reason the steps above do not work, set the driver to Debug logging and a Manual refresh and let me know what shows up when you perform a refresh.

2 Likes

Ok. Step 4 was the key. Whenever I created an API Key, I also added an application description. Once I created an API key but did not provide an application description and entered that API key in your driver, it worked! Yeah!!

Thank you so much for the extra clarification. That was the key!!!!

Glad it is working!