[PROJECT] Driver for AmbientWeather API


#1

New driver to support the personal weather station I just got. This driver polls the AmbientWeather API at 1, 5, or 15 minute intervals (defaults at 5) for a device that you have the MAC address and User API Key for (so basically only your own station). I received a developer application key from AmbientWeather and seem to have all the basics working.

The driver will report all known fields listed in the AmbientWeather API that are not null EXCEPT the 24hourrainin field (apparently Groovy is not happy about fields starting with a number). It dumps every field into states and sends events for the 4 types Hubitat has capabilities for (temperature, humidity, pressure, and UV).

There is also a set of simple boolean preferences to select whether you want outdoor or indoor temperature and humidity to be in the events.

I have also made some simple handling if your local temperature units are in F or C but only for the temperature. No other conversions are done at this time but I do plan on making metric conversions for windspeed and similar fields.

You can find the latest version of the driver here:
[https://www.drdsnell.com/projects/hubitat/drivers/AmbientWeather.groovy]

One last note... If you decide to make your own version of this driver you must get your own developer Application Key from AmbientWeather. It is quick and free... If you want to rely on my driver, you can leave my key in there.


#2

Posted version 0.4 with the following changes:

  • Post all variables as Events also so that the data can be displayed in dashboards and used by Rules.
  • Conversion of many variables between metric/imperial measurements based on Hubitat's location.getTemperatureScale().
  • Added variables to account for conversions in some cases. Ex: windGust was added and will display mph or converted kph. However the original windgustmph the weather station reports will also still be displayed.
  • Found that the Weather tile in dashboards reports windSpeed and windDirection attributes, which are not in Hubitat documentation, so added those with the appropriate values.

Upcoming change(s):

  • "Human readable" wind direction. Ex: North, North-East, etc...

#3

I've been using this driver since March, what are you looking to do different than this one? Ambient Weather Device


#4

To be honest I did not know that one existed when I created mine. I had seen a thread about one but the initial thread read like it only did a couple variables and Ambient did not have one listed for Hubitat.

So I made my own. I also reached out to Ambient and they will be happy to list one for Hubitat, although I am still waiting to work on mine more (I was hoping for feedback) and a response from Hubitat for some questions I asked them.

I guess I will have to look at that driver, but I do not want anyone thinking I "copied" something. Do far as I know I am not lacking any data field from Ambient besides the 24hourrainin one, but I have a fix for that (I think, my station does not report that field so it is tough to tell) that will be in version 0.5.


#5

I’ve got it working great. One request would be to have solar radiation map to an illuminance or lux value in order to use it for lighting automations.

thanks for working on this


#6

That sounds pretty reasonable. I will try to get a new version out this weekend (maybe, but no promises late tonight).


#7

@snell Great driver BTW. I noticed you mentioned above about converting wind direction to a name. That would be great. Also is there a possibility of getting baromrelin? thanks


#8

I know I had it reading Baromrelin in general... So two questions:

  1. Just to be sure, you are running the latest driver version posted 0.4?
  2. Is it not showing in the list of state variables or events at all? If it is shown, is there a Hubitat value you want it duplicated to?

Either way, I should be able to have that fixed/added tonight, tomorrow at the latest.


#9

@snell Yes I am running latest .4. I am not seeing the relative just the absolute in the attribute list. thanks

EDIT: I see baromrelin on line 91 of driver just not in the attribute list.


#10

OK. So something I missed in the driver (darn). Bugs always take priority so I will work on that tonight.


#11

No problem at all. Take your time. Thanks


#12

I have posted version 0.5. It should take care of the baromrelin not being sent as an event. It also added compass points (based on a preference for how you want them reported) as "WindDirectionString" as well as reports illuminance based on the solarradiation variable.


#13

@snell The baromrelin and Illuminance work great.Not sure what to do with the WindDirectionString. It reads the same as windDirection. Is there something we have to do? thanks

EDIT: it would help if I would scroll down the page a little on the driver page and select from the drop-down!! :roll_eyes: All working! thanks


#14

@razorwing:
Thanks! Question about the dropdown for wind direction... Does the naming I chose seem confusing or is it OK for what the various methods do?


#15

@snell I think they are great. I have tried the 8 and 16 Word versions and they both are working fine. Wording is perfect.


#16

Working now. The MAC address has to have colons included. Could you either note that in the driver or remove the requirement? When you open IPTools, it gives you the MAC address with dashes, vs the web console that gives you colons. I first tried with dashes and that didn't work, so I removed them and when that didn't work I started thinking my key wasn't right, since the log simply shows "Getting data for MAC: 000EC61xxxxx"

Perhaps you could show a detailed error that the MAC address isn't entered in the correct format if it's not possible to allow any of the three formats for entering it?


#17

What's the difference with the Current State vs the State Variables shown?

I get different values for temp1 and humidity1 in each.

Current States
53%20AM
State Variables
43%20AM 27%20AM 03%20AM


#18

Hey @snell! This is good! It's choosing my indoor humidity and yet still displaying my add-on sensor humidity level. Nice!

Of course, I don't have my original outdoor temp/humidity sensor powered up right now, so is it mapping outdoor to indoor humidity? They seem to show as the same right now. I have ordered what I think might work as a replacement for the factory outdoor WH32E sensor, but won't know for a week or so.


#19

I will see if there is something I can do about the MAC address. At the very least I will make the description better for v0.6, but maybe I can figure a way to accommodate multiple styles... Something to think on. Not sure how to display an error on preferences yet... Must be a way though.

I typically store all variables I am dealing with as state variables, so everything starts there. Then, in this case, I sent each one over as an Event, so they show in Current States. If I do not send them as an Event, they are not able to be displayed in the dashboard for example. Originally I was not sure everyone would want every single possible value. I may thin out what is in the variables in the future.

It is weird that they would have different values. For most everything I just repeat the value from the state variable to the Current State event... so I will have to look at why it might be different.


#20

luminance is working great! this driver seems really solid.

thanks