[PROJECT] Driver for AmbientWeather API


#42

Ambient Weather recently added the feelsLike and dewPoint for add-on sensors to the API. This was released last week.

The API reports them as:
feelsLike1,2,3,4 etc
dewPoint1,2,3,4 etc

Here's a full API output from my systems. I have a "little" experience with Ambient Weather if you have any questions.

[
{
    "macAddress": "",
    "lastData": {
        "dateutc": 1567566300000,
        "winddir": 10,
        "windspeedmph": 0,
        "windgustmph": 0,
        "maxdailygust": 4.5,
        "tempf": 65.8,
        "hourlyrainin": 0,
        "dailyrainin": 0,
        "weeklyrainin": 0.1,
        "monthlyrainin": 0.1,
        "totalrainin": 77.24,
        "baromrelin": 29.99,
        "baromabsin": 29.45,
        "humidity": 91,
        "tempinf": 74.7,
        "humidityin": 52,
        "uv": 0,
        "solarradiation": 0,
        "feelsLike": 65.8,
        "dewPoint": 63.1,
        "feelsLikein": 74.3,
        "dewPointin": 55.9,
        "lastRain": "2019-09-02T22:59:00.000Z",
        "tz": "America/New_York",
        "date": "2019-09-04T03:05:00.000Z"
    },
    "info": {
        "name": "WS-2902",
        "location": "Home"
    }
},
{
    "macAddress": "",
    "lastData": {
        "dateutc": 1567566240000,
        "winddir": 219,
        "windspeedmph": 0,
        "windgustmph": 0,
        "maxdailygust": 7.61,
        "tempf": 66.6,
        "battout": 1,
        "humidity": 91,
        "hourlyrainin": 0,
        "eventrainin": 0,
        "dailyrainin": 0,
        "weeklyrainin": 0.04,
        "monthlyrainin": 0.04,
        "yearlyrainin": 6.69,
        "totalrainin": 6.69,
        "tempinf": 72.1,
        "battin": 1,
        "humidityin": 62,
        "baromrelin": 30.21,
        "baromabsin": 29.45,
        "uv": 0,
        "solarradiation": 0,
        "temp1f": 75.38,
        "humidity1": 51,
        "batt1": 1,
        "temp5f": 68.9,
        "humidity5": 69,
        "batt5": 1,
        "temp7f": 75.74,
        "humidity7": 67,
        "batt7": 1,
        "temp8f": 72.86,
        "humidity8": 51,
        "batt8": 1,
        "feelsLike": 66.6,
        "dewPoint": 63.89,
        "feelsLike1": 75,
        "dewPoint1": 56,
        "feelsLike5": 68.7,
        "dewPoint5": 58.3,
        "feelsLike7": 76.2,
        "dewPoint7": 64,
        "feelsLike8": 72.2,
        "dewPoint8": 53.7,
        "feelsLikein": 71.9,
        "dewPointin": 58.3,
        "lastRain": "2019-09-02T19:12:00.000Z",
        "tz": "America/New_York",
        "date": "2019-09-04T03:04:00.000Z"
    },
    "info": {
        "location": "Home-OIP",
        "name": "WS-1401"
    }
},
{
    "macAddress": "",
    "lastData": {
        "dateutc": 1567044840000,
        "tempinf": 74.3,
        "humidityin": 57,
        "battout": 1,
        "temp1f": 69.8,
        "humidity1": 67,
        "batt1": 1,
        "batt2": 1,
        "temp3f": 69.9,
        "batt3": 1,
        "feelsLike1": 69.6,
        "dewPoint1": 58.3,
        "feelsLike2": 71.2,
        "dewPoint2": 59.7,
        "feelsLikein": 74.1,
        "dewPointin": 58.1,
        "soiltemp2": 71.2,
        "soilhum2": 67,
        "tz": "America/New_York",
        "date": "2019-08-29T02:14:00.000Z"
    },
    "info": {
        "location": "Home",
        "name": "WS-8482"
    }
}

]


Best way To Link Ambient Weather to Dashboard
#43

Thanks! More work to do then... I have to subscribe to API changes or such as well.


#44

V0.7 is now posted. It has:

  1. Calculation for dewPoint if not received from API.
  2. Calculation for HeatIndex (if tempf >= 80)
  3. Calculation for WindChill (if tempf < 50 and windSpeed > 3)
  4. Error checking and limited correction for MAC Address.
  5. Additional attributes per @jeubanks mention above (although I just realized I did not list all the attributes in the beginning, they are all in the parsing and should send events, cannot fix that until tonight).

#45

v0.8 is now posted. Changes include:

  1. Added the missing attributes to the attribute list from 0.7.
  2. Found a couple attributes that were not converting to metric properly and fixed those.
  3. Cleaned up a number of unit listings in events.
  4. Major rework of metric conversion... I think I have all attributes accounted for now and cleaned up the code around it a lot. All converted attributes are rounded to hundredth place (0.01) because otherwise some of them got pretty long. They all seem to be accurate to me when switching my Hubitat to C, but if anyone spots anything funny please let me know.

#46

@snell Everything looks good except I see where WindChill is Null. Otherwise all is working.


#47

WindChill probably would be null at this time.

It is only calculated when it is cold... so <50 degrees AND when wind speed is > 3. Similarly, HeatIndex is only calculated when it is >=80 degrees

I have not found any way to clear the "Current States" of Hubitat besides replacing the values. So if you send a value but then never send a new event it will always remain that old value. In the case of WindChill and HeatIndex, those would stick around even when they are not being calculated anymore. So rather than leave bad values there that might be confusing I chose to send them as null.


#48

Got it. Sounds good. It is working great BTW. It is too bad the 2902 doesn't give the battery attribute. It would be nice to monitor that as well. Really not a problem for this unit because the display has it.


#49

Perhaps a firmware upgrade? I didn't have battery values either until the firmware upgrade that was necessary for the Observer IP bridge to add support for the add-on sensors. I realize your unit doesn't use the Observer IP bridge, but maybe there's still an upgrade to the display (which is taking on the role of an Observer IP bridge in your case).


#50

Thanks, I will look into seeing if there is an upgrade.


#51

Hey, it works! :smiley: This is the exact same sensor that Ambient Weather uses. And even though they sell it on Amazon as an ECOWHITT WH32 vs Ambient Weather's WH32E, it actually says WH32E on the back of it. Nice!

So if anyone is looking for replacement sensors for their Ambient Weather station, I can confirm this particular one is an exact replacement for the outdoor WH32E sensor and you should try Ecowitt first. Was less expensive too. $12.99 vs $18.79 for the Ambient Weather WH31B add-on outdoor sensor.


Ambient Weather Device
#52

Is it reporting as a tempf or temp1f?


#53

tempf ! :grin:


#54

Nice!


#55

I'm thinking of purchasing one of these ambient weather stations for my home. Can someone tell me what I will need to purchase to make this work successfully? I see several different options?


#56

I use this one Ambient Weather WS-2902A Smart Weather Station with WiFi Remote Monitoring and Alerts


#57

You may also consider Ecowitt. It’s the same Fine Offset equipment, and there should be a driver for it soon too.


#58

FYI - The lastest firmware for the GW1000 has been released and it supports custom endpoint for URL posting. Now the GW1000 can be integrated with any system that can accept a POST and parse the input.


#59

Can you give an example of how you would parse the input in HE?


#60

No sorry. I haven't done any HE development in a long time. The data is in the body in standard form format though.

param=value&param1=value1&param2=value2& and so on...


#61
def data = "session=234567893egshdjchasd&userId=12345673456&timeOut=1800000"
def map = [:]

data.split("&").each {param ->
    def nameAndValue = param.split("=")
    map[nameAndValue[0]] = nameAndValue[1]
}
log.debug "$map.userId, $map.timeOut"