naofireblade / homebridge-weather-plus

A comprehensive weather plugin for homebridge.
MIT License
314 stars 63 forks source link

New Weather Undergroud API #67

Closed DSchumacher2104 closed 5 years ago

DSchumacher2104 commented 5 years ago

Hello @naofireblade !

After WU disabled free API-Keys last year, there is a new method to get data from PWS with API-Calls. It would be very nice, if you could add this feature into your plugin so we can use the PWS-feature of WU in HomeKit again. When entering an existing pws as StationID like "IDARMSTA223" and using this API-Call https://api.weather.com/v2/pws/observations/current?apiKey=6532d6454b8aa370768e63d6ba5a832e&stationId=StationID&format=json&units=m

we get a JSON

{ "observations": [ { "stationID": "IDARMSTA223", "obsTimeUtc": "2019-05-27T08:00:25Z", "obsTimeLocal": "2019-05-27 10:00:25", "neighborhood": "Tulpenweg", "softwareType": "WH2602 V4.5.6", "country": "DE", "solarRadiation": 159.31, "lon": 8.64811707, "realtimeFrequency": null, "epoch": 1558944025, "lat": 49.90708923, "uv": 2.0, "winddir": 103, "humidity": 93, "qcStatus": 1, "metric": { "temp": 15, "heatIndex": 15, "dewpt": 14, "windChill": 15, "windSpeed": 0, "windGust": 0, "pressure": 1008.81, "precipRate": 0.0, "precipTotal": 1.02, "elev": 224 } } ] }

The API-Key is a public-key and does't change. Sadly, there is no forecast, but we can get local weather data again! Update-intervall shloud be 600 sec.

Thanks for your work!

rsonnens commented 5 years ago

I second this request, I'd love for the newer API to be enanabled (I have a public API key that is obviously different than the one above.)

The weather underground folks gave me this key for the asking and is available to non-legacy users such as myself.

mwkchan commented 5 years ago

As I run my own PWS, I am totally supportive on the suggestion!

knuckleheadsmiff commented 5 years ago
Screen Shot 2019-09-02 at 12 37 29 PM

So I made my own branch that I hooked up to the new API--I kept the old implementation as-is.

Only thing that I don't get is how I can see 'custom characteristics' in the home app--or I have some bug? I can only see temperature and humidity. Which is fine as all I wanted to do was ask siri the temp outside my house. ;-)

Also, while it takes 'units' as a config parameter homekit seems to only understating metric but reports to me in Fahrenheit which is what I want.So I'm not sure I understand what the units in the config do.also should I use si or metric units?

I don't have an EVE or use that app so maybe the stuff shows up there?

I have no plans to ask to ask to merge this back as it is my "first" git project and "npm". Sadly I debugged the old fashion way, could not figure out how to debug the HomeKit plugins in a nodeJS debugger. That would have made things easier. :-(

If I understood the custom characteristics, and could test them, and if I understood the way units were intended to work i’d an attempt request to push to the master but at this point I don’t want to add crap code.

[update 9/2] OK I think I figured out the units, code wants things in 'is' and the characteristic filters handle units as specified in the config file--although it reports to the HomeKit for temperature in cel--always.

I think the custom characteristics, I added logging where they get set, are being set correctly but I still don't know how to see them in either the home UI, or when using the homebridge-config-ui-x plugin fo a browser UI.

But I did see something not great in the "custom characteristics" code, if does not truncates or round reasonable after converting to different units. I noticed this when looking as the windspeeds, and then say that was true with more of the code. I think that is a bug, but since I can't see them in a UI (someone please tell me how) I guess it does not matter.

I've attached an image that homebridge-config-ui-x shows as reported, all this same info (and really nothing else) shows in the Home app. My config looks like this with my changes:

    {
        "platform": "WeatherPlus",
        "name": "WeatherPlus",
        "interval": 5,
        "displayName": "Outside",
        "units": "si",
        "service": "weatherunderground_new",
        "key": "WEATHER-UNDERGROUND NEW API KEY GOES HERE",
        "location": "WEATHER-UNDERGROUND STATION ID HERE"
    },
knuckleheadsmiff commented 5 years ago

Whoo, I installed the EVE app and I see the custom characteristics! All look correct. I think I fix pop do doc file tomorrow and request this to be pushed to the main release.

IMG_2799

knuckleheadsmiff commented 5 years ago

Ok Pals! I created a pull request to get this back to the master branch. Since the above post I've removed the old API since it has been offline since March so no need to preserve that old code. That caused me to rename a few files and clean up some cruft. I've also fixed the "observation time' field. This is the time that weather station data was last pushed to weather underground feed, not the time the data was pulled (unlike the the other plugging which use the time the data was pulled.)

I also added rain total for the day amounts. I had some more info but I afaik the Eve I push all the info that WU feed gives me that Eve and the Apple Home app understand.

Pull request: https://github.com/naofireblade/homebridge-weather-plus/pull/72

mwkchan commented 5 years ago

Well done!

How can we manually upgrade to your branch before it get merged back to the main branch?

Sent from my iPhone

On 3 Sep 2019, at 04:20, rsonnens notifications@github.com wrote:

 Whoo, I installed the EVE app and I see the custom characteristics! All look correct. I think I fix pop do doc file tomorrow and request this to be pushed to the main release.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

cyberhusky69 commented 5 years ago

Great work. Do I understand this correctly that this plugin is for users with an own weatherstation?

knuckleheadsmiff commented 5 years ago

should be able to install from here:

https://github.com/knuckleheadsmiff/homebridge-weather-plus

Doc instructions has been updated.

The install should just have my name In the path.

sudo npm install -g knuckleheadsmiff/homebridge-weather-plus

naofireblade commented 5 years ago

Awesome! I will merge the PR in the next few days.

knuckleheadsmiff commented 5 years ago

Naofireblade, need any help with the merge? Let me know if you have issues.

naofireblade commented 5 years ago

Thanks for the reminder. I just had no time to look into the code until now. I cannot test it without a device that can post to weather underground but the code looks code. I made some minor changes and submitted the new version. Thank you very much for your help! Pull Requests are keeping open source projects alive :) .

knuckleheadsmiff commented 5 years ago

Thanks, I think the unused callback was left over from probably a first version.

That that/this charge was not really necessary as I did bind “this” The the function call call but your change should not matter and is also correct.

I’ll install and test this afternoon.

knuckleheadsmiff commented 5 years ago

Seem to be working. ;-)

thanks for merging.

quim-net commented 5 years ago

Hello, thank you very much, I have managed to follow my pws on eve through hombrigde.

quim-net commented 5 years ago

024AB0DF-CEBD-472B-9D87-B0CEB0AB72AE

quim-net commented 4 years ago

Hi, D2986A71-6B75-4919-8B25-91B6D211890A 4338B56F-05F4-4CCD-9E2F-ED1CCBDB1500

in the last update of "eve" shows again the drop-down menu of temperature and other

knuckleheadsmiff commented 4 years ago

in the last update of "eve" shows again the drop-down menu of temperature and other

Interesting. This historical data is most likely retained in homekits database. I wish Apple’s home app would expose it.

naofireblade commented 4 years ago

The data is retained in a json file (also configurable to google cloud drive) of your homebridge installation and queried when the device is opened in eve. It's a custom eve format and sadly not stored in a homekit database on apple servers.

But really cool from the eve guys to keep compatibility with these custom installations. They also added a ton of icons and translations in their app for custom device characteristics that me and other developers created.