siku2 / hass-weatherlink

Home Assistant integration for Davis Instruments' WeatherLink and AirLink
MIT License
26 stars 7 forks source link

Support for extra sensors? #10

Open cambmint opened 3 years ago

cambmint commented 3 years ago

First of all, congratulations on developing this integration. I have had a Vantage Pro 2 since 2008, but only bought a WeatherLink Live last week and added it to my Home Assistant today where I now foresee lots of opportunities for automations.

I was wondering how difficult it might be to extend your component to support "Extra Sensors"? For instance, I have a Temp/Hum unit in the greenhouse and it'd great to receive notifications about it overheating or a frost alarm.

No matter; many thanks indeed for all your work! Simon

siku2 commented 3 years ago

Since I don't have such a sensor lying around to play around with, it all comes down to how much info you can provide me with (because Davis' instruments sure didn't bother documenting their stuff properly). First thing I would like to look at is the JSON payload from

http://\/v1/current_conditions

Hopefully your sensor will show up there.

cambmint commented 3 years ago

Thanks; JSON attached. The stations are assigned as follows:- 1 - ISS 2 - Temp/Hum (in greenhouse) 3 - Temp/Hum (in cellar) 4 - Leaf/Soil (Temp on Port 1; Leaf Soil on Port 1; nothing on Moisture) 5 - no device 6 - Wind (note not wired to ISS) 7 - no device 8 - Relay (to second VPro2 console)

cambmint current conditions 2021-06-18.txt

siku2 commented 3 years ago

This is going to require a lot of refactoring, but it's definitely doable. The current approach doesn't work at all for this use-case (as outlined in the limitations section of the README).

I think a sensible strategy here would be to assign each transmitter id (txid) its own device in Home Assistant, each with its own sensors. I'm not sure how to deal with the other entities like the weather, though. For now, it'll probably just use the sensors from the device with the lowest txid and there will be an option to disable it altogether.

labbs1 commented 3 years ago

Hi and thanks for this contribution,

I have the same wish as cambmint. Your integration works fine but I miss out on all rain data except storm and I guess this has to do with the fact that the entities gets populated in some sort of txid order and since my Temp/Hum reports 0 (not null) on rainfall on txid 2 it does not bother about the real values from ISS at txid 6.

Could one approach be to let the user choose which station id to use for a specific entity? Although it would have been great to be able to see all readings ;)

Thanks again!

siku2 commented 3 years ago

Could one approach be to let the user choose which station id to use for a specific entity?

Not sure how this is better than splitting it into multiple devices as I suggested in my previous comment. The way I see it, this is strictly inferior since you can achieve the same effect with the multiple device method simply by disabling all the devices/entities you don't need.

cambmint commented 3 years ago

Referring to my 18 June post, I decided to disable one of the Temp/Hum stations (the one in the Cellar) for the time being in order to have all the other stations working...

labbs1 commented 1 year ago

@siku2 The "problem" I am facing is that the integration shows the wrong temperature value. I would like to use them all but at least the correct onces. If you look att my json below, the value that shows for temp and hum are from station id 8 (68,2 and 81.6%), while the correct values should be from station id 6, my ISS (67.1 and 75.1%)

Thanks for looking at this :)

{
    "data": {
        "did": "001D0Axxxxxx",
        "ts": 1692711707,
        "conditions": [
            {
                "lsid": 271031,
                "data_structure_type": 1,
                "txid": 8,
                "temp": 68.3,
                "hum": 81.6,
                "dew_point": 62.5,
                "wet_bulb": 64.3,
                "heat_index": 69.5,
                "wind_chill": null,
                "thw_index": null,
                "thsw_index": null,
                "wind_speed_last": null,
                "wind_dir_last": null,
                "wind_speed_avg_last_1_min": null,
                "wind_dir_scalar_avg_last_1_min": null,
                "wind_speed_avg_last_2_min": null,
                "wind_dir_scalar_avg_last_2_min": null,
                "wind_speed_hi_last_2_min": null,
                "wind_dir_at_hi_speed_last_2_min": null,
                "wind_speed_avg_last_10_min": null,
                "wind_dir_scalar_avg_last_10_min": null,
                "wind_speed_hi_last_10_min": null,
                "wind_dir_at_hi_speed_last_10_min": null,
                "rain_size": 1,
                "rain_rate_last": 0,
                "rain_rate_hi": 0,
                "rainfall_last_15_min": 0,
                "rain_rate_hi_last_15_min": 0,
                "rainfall_last_60_min": 0,
                "rainfall_last_24_hr": 0,
                "rain_storm": null,
                "rain_storm_start_at": null,
                "solar_rad": null,
                "uv_index": null,
                "rx_state": 0,
                "trans_battery_flag": 0,
                "rainfall_daily": 0,
                "rainfall_monthly": 0,
                "rainfall_year": 0,
                "rain_storm_last": null,
                "rain_storm_last_start_at": null,
                "rain_storm_last_end_at": null
            },
            {
                "lsid": 271032,
                "data_structure_type": 1,
                "txid": 3,
                "temp": null,
                "hum": null,
                "dew_point": null,
                "wet_bulb": null,
                "heat_index": null,
                "wind_chill": null,
                "thw_index": null,
                "thsw_index": null,
                "wind_speed_last": 10.00,
                "wind_dir_last": 221,
                "wind_speed_avg_last_1_min": 9.93,
                "wind_dir_scalar_avg_last_1_min": 221,
                "wind_speed_avg_last_2_min": 10.00,
                "wind_dir_scalar_avg_last_2_min": 221,
                "wind_speed_hi_last_2_min": 12.00,
                "wind_dir_at_hi_speed_last_2_min": 223,
                "wind_speed_avg_last_10_min": 10.06,
                "wind_dir_scalar_avg_last_10_min": 221,
                "wind_speed_hi_last_10_min": 13.00,
                "wind_dir_at_hi_speed_last_10_min": 219,
                "rain_size": 1,
                "rain_rate_last": 0,
                "rain_rate_hi": 0,
                "rainfall_last_15_min": 0,
                "rain_rate_hi_last_15_min": 0,
                "rainfall_last_60_min": 0,
                "rainfall_last_24_hr": 0,
                "rain_storm": null,
                "rain_storm_start_at": null,
                "solar_rad": null,
                "uv_index": null,
                "rx_state": 0,
                "trans_battery_flag": 0,
                "rainfall_daily": 0,
                "rainfall_monthly": 0,
                "rainfall_year": 0,
                "rain_storm_last": null,
                "rain_storm_last_start_at": null,
                "rain_storm_last_end_at": null
            },
            {
                "lsid": 271033,
                "data_structure_type": 1,
                "txid": 4,
                "temp": 85.3,
                "hum": null,
                "dew_point": null,
                "wet_bulb": null,
                "heat_index": null,
                "wind_chill": null,
                "thw_index": null,
                "thsw_index": null,
                "wind_speed_last": null,
                "wind_dir_last": null,
                "wind_speed_avg_last_1_min": null,
                "wind_dir_scalar_avg_last_1_min": null,
                "wind_speed_avg_last_2_min": null,
                "wind_dir_scalar_avg_last_2_min": null,
                "wind_speed_hi_last_2_min": null,
                "wind_dir_at_hi_speed_last_2_min": null,
                "wind_speed_avg_last_10_min": null,
                "wind_dir_scalar_avg_last_10_min": null,
                "wind_speed_hi_last_10_min": null,
                "wind_dir_at_hi_speed_last_10_min": null,
                "rain_size": 1,
                "rain_rate_last": 0,
                "rain_rate_hi": 0,
                "rainfall_last_15_min": 0,
                "rain_rate_hi_last_15_min": 0,
                "rainfall_last_60_min": 0,
                "rainfall_last_24_hr": 0,
                "rain_storm": null,
                "rain_storm_start_at": null,
                "solar_rad": null,
                "uv_index": null,
                "rx_state": 0,
                "trans_battery_flag": 0,
                "rainfall_daily": 0,
                "rainfall_monthly": 0,
                "rainfall_year": 0,
                "rain_storm_last": null,
                "rain_storm_last_start_at": null,
                "rain_storm_last_end_at": null
            },
            {
                "lsid": 271034,
                "data_structure_type": 1,
                "txid": 6,
                "temp": 67.1,
                "hum": 75.1,
                "dew_point": 58.9,
                "wet_bulb": 61.4,
                "heat_index": 67.6,
                "wind_chill": 65.1,
                "thw_index": 65.6,
                "thsw_index": 75.3,
                "wind_speed_last": 10.00,
                "wind_dir_last": 221,
                "wind_speed_avg_last_1_min": 9.93,
                "wind_dir_scalar_avg_last_1_min": 221,
                "wind_speed_avg_last_2_min": 10.00,
                "wind_dir_scalar_avg_last_2_min": 221,
                "wind_speed_hi_last_2_min": 12.00,
                "wind_dir_at_hi_speed_last_2_min": 223,
                "wind_speed_avg_last_10_min": 10.06,
                "wind_dir_scalar_avg_last_10_min": 221,
                "wind_speed_hi_last_10_min": 13.00,
                "wind_dir_at_hi_speed_last_10_min": 219,
                "rain_size": 2,
                "rain_rate_last": 0,
                "rain_rate_hi": 0,
                "rainfall_last_15_min": 0,
                "rain_rate_hi_last_15_min": 0,
                "rainfall_last_60_min": 0,
                "rainfall_last_24_hr": 0,
                "rain_storm": 0,
                "rain_storm_start_at": null,
                "solar_rad": 577,
                "uv_index": 2.2,
                "rx_state": 0,
                "trans_battery_flag": 0,
                "rainfall_daily": 0,
                "rainfall_monthly": 758,
                "rainfall_year": 3077,
                "rain_storm_last": 59,
                "rain_storm_last_start_at": 1692488161,
                "rain_storm_last_end_at": 1692586860
            },
            {
                "lsid": 271029,
                "data_structure_type": 4,
                "temp_in": 84.3,
                "hum_in": 45.8,
                "dew_point_in": 61.2,
                "heat_index_in": 84.6
            },
            {
                "lsid": 271028,
                "data_structure_type": 3,
                "bar_sea_level": 30.017,
                "bar_trend": -0.005,
                "bar_absolute": 29.975
            }
        ]
    },
    "error": null
}
siku2 commented 1 year ago

@labbs1, this integration is due for a bit of modernization anyway. You can expect a new version in the coming days and I will try to accommodate the requested changes, like this one.

labbs1 commented 1 year ago

@siku2 Sounds very interesting. Looking forward for it, thanks!