BKeyport / homebridge-davis

My Spin on a Homebridge plugin for Davis Weatherlink Live
MIT License
0 stars 0 forks source link

Add support for Airlink #1

Closed sschwetz closed 1 year ago

sschwetz commented 1 year ago

Hi, would it be possible to add the davis airlink to be supported by this plugin.

API call is the same as weatherlink, and will return the below

{ "data": { "did": "001D0A10060C", "name": "Airlink", "ts": 1693751448, "conditions": [{ "lsid": 534765, "data_structure_type": 6, "temp": 48.1, "hum": 76.6, "dew_point": 41.1, "wet_bulb": 44.2, "heat_index": 47.8, "pm_1_last": 4, "pm_2p5_last": 5, "pm_10_last": 5, "pm_1": 4.37, "pm_2p5": 6.27, "pm_2p5_last_1_hour": 4.98, "pm_2p5_last_3_hours": 5.82, "pm_2p5_last_24_hours": 4.37, "pm_2p5_nowcast": 5.18, "pm_10": 6.44, "pm_10_last_1_hour": 5.46, "pm_10_last_3_hours": 6.61, "pm_10_last_24_hours": 5.01, "pm_10_nowcast": 5.84, "last_report_time": 1693751448, "pct_pm_data_last_1_hour": 100, "pct_pm_data_last_3_hours": 100, "pct_pm_data_nowcast": 100, "pct_pm_data_last_24_hours": 100 }] }, "error": null }

This is returning Fahrenheit even though it is configured to be celsius in the app.

I would love to get the 2.5ppm and 10ppm counts in as homekit sensors

BKeyport commented 1 year ago

I just published 0.9.10 - this reworked the code a bit to allow for additional modules (I was planning to do this anyway), and added in the basis for airlink support.

For now, I should have the temp and humidity working. Basis for PM sensors is in place, I just gotta figure out how to add them to the list for Homekit.

Give it a shot, and let me know if it works, thanks!

sschwetz commented 1 year ago

Hi, work has been hectic and I didnt get a notification for this, and just checked back. I have updated this plugin but get the following in the logs

[9/30/2023, 1:30:29 PM] [Airlink] Loaded homebridge-davis v0.9.50 child bridge successfully

/var/lib/homebridge/node_modules/homebridge-davis/index.js:120
                                .on("get", this.getPM2p5.bind(this));
    ^
TypeError: Cannot read properties of undefined (reading 'on')
    at davis.getServices (/var/lib/homebridge/node_modules/homebridge-davis/index.js:120:5)
    at BridgeService.createHAPAccessory (/var/lib/homebridge/node_modules/homebridge/src/bridgeService.ts:461:41)
    at ChildBridgeFork.startBridge (/var/lib/homebridge/node_modules/homebridge/src/childBridgeFork.ts:175:46)
[9/30/2023, 1:30:29 PM] [Airlink] Child bridge process ended

To assist I have published the API here: http://14.202.65.230:1234/v1/current_conditions

BKeyport commented 1 year ago

There's something wrong with the PM2.5 reading - I'm not exactly sure what, however. Please leave the weather data open if you don't mind, so I can continue to work at it. In short term, I've disabled the PM2.5 data stream, will be uploading a interim module a little later, want to look at other bug first.

BKeyport commented 1 year ago

Turns out, Apple named it differently than the rest of the world, of course.

Works now. Unless something's weird on your end, I don't need the data anymore. Thank you for your help!

sschwetz commented 1 year ago

Thanks for doing this, working perfectly