Open NickBusey opened 3 years ago
I need to look at the returned raw data and figure out how this is structured with more than 1 sensor. Could you go to this website: https://weatherflow.github.io/Tempest/api/swagger/#!/observations/getStationObservation
Then start by clicking on the big Authorize button, under the section Token Authorization
type the Token you also use for this Integration.
Now expand the section GET /observations/station/{station_id}
and under parameters key in your station_id. Click the Try it Out button.
Scroll down and select everything in the yellow box called Response Body
and post it here. That is the same data that is returned when you use this integration
Looks like when I query the observations of the station ID, I only get one of the sensors values back.
{
...
"is_public": true,
"status": {
"status_code": 0,
"status_message": "SUCCESS"
},
"station_units": {
"units_temp": "f",
"units_wind": "mph",
"units_precip": "in",
"units_pressure": "inhg",
"units_distance": "mi",
"units_direction": "cardinal",
"units_other": "imperial"
},
"outdoor_keys": [
"timestamp",
"air_temperature",
"barometric_pressure",
"station_pressure",
"pressure_trend",
"sea_level_pressure",
"relative_humidity",
"precip",
"precip_accum_last_1hr",
"precip_accum_local_day",
"precip_accum_local_yesterday_final",
"precip_minutes_local_day",
"precip_minutes_local_yesterday_final",
"wind_avg",
"wind_direction",
"wind_gust",
"wind_lull",
"solar_radiation",
"uv",
"brightness",
"lightning_strike_last_epoch",
"lightning_strike_last_distance",
"lightning_strike_count",
"lightning_strike_count_last_1hr",
"lightning_strike_count_last_3hr",
"feels_like",
"heat_index",
"wind_chill",
"dew_point",
"wet_bulb_temperature",
"delta_t",
"air_density"
],
"obs": [
{
"timestamp": 1632931666,
"air_temperature": 12.8,
"barometric_pressure": 742.5,
"station_pressure": 742.5,
"sea_level_pressure": 1020.9,
"relative_humidity": 60,
"precip": 0,
"precip_accum_last_1hr": 0,
"precip_accum_local_day": 0,
"precip_accum_local_yesterday": 0.891868,
"precip_accum_local_yesterday_final": 0,
"precip_minutes_local_day": 0,
"precip_minutes_local_yesterday": 9,
"precip_minutes_local_yesterday_final": 0,
"precip_analysis_type_yesterday": 1,
"wind_avg": 0.5,
"wind_direction": 355,
"wind_gust": 1,
"wind_lull": 0,
"solar_radiation": 232,
"uv": 2.49,
"brightness": 27945,
"lightning_strike_last_epoch": 1613542709,
"lightning_strike_last_distance": 1,
"lightning_strike_count": 0,
"lightning_strike_count_last_1hr": 0,
"lightning_strike_count_last_3hr": 0,
"feels_like": 12.8,
"heat_index": 12.8,
"wind_chill": 12.8,
"dew_point": 5.2,
"wet_bulb_temperature": 8.4,
"delta_t": 4.4,
"air_density": 0.90456,
"pressure_trend": "rising"
}
]
}
But if I do get/stations/station_id, it returns a list of devices.
{
"stations": [
{
....
"timezone_offset_minutes": -360,
"station_meta": {
"share_with_wf": true,
"share_with_wu": true,
"elevation": 2606.29541015625
},
"last_modified_epoch": 1632931206,
"created_epoch": 1576532276,
"devices": [
{
"device_id": 48094,
"serial_number": "HB-00014149",
"device_meta": {
"agl": 0,
"name": "HB-00014149",
"environment": "indoor",
"wifi_network_name": ""
},
"device_type": "HB",
"hardware_revision": "0",
"firmware_revision": "171"
},
{
"device_id": 48104,
"serial_number": "AR-00014198",
"device_meta": {
"agl": 3.04800003767014,
"name": "Deck",
"environment": "outdoor",
"wifi_network_name": ""
},
"device_type": "AR",
"hardware_revision": "1",
"firmware_revision": "23"
},
{
"device_id": 48106,
"serial_number": "SK-00003002",
"device_meta": {
"agl": 6.096000075340271,
"name": "Sky",
"environment": "outdoor",
"wifi_network_name": ""
},
"device_settings": {
"show_precip_final": true
},
"device_type": "SK",
"hardware_revision": "1",
"firmware_revision": "43"
},
{
"device_id": 82405,
"serial_number": "AR-00005483",
"device_meta": {
"agl": 1.5240000188350677,
"name": "Greenhouse",
"environment": "outdoor",
"wifi_network_name": ""
},
"device_type": "AR",
"hardware_revision": "1",
"firmware_revision": "23"
}
],
"station_items": [
{
"location_item_id": 117044,
"location_id": 13797,
"device_id": 48104,
"item": "air_temperature_humidity",
"sort": 0,
"station_id": 13797,
"station_item_id": 117044
},
{
"location_item_id": 210507,
"location_id": 13797,
"device_id": 82405,
"item": "air_temperature_humidity",
"sort": 1,
"station_id": 13797,
"station_item_id": 210507
},
{
"location_item_id": 117046,
"location_id": 13797,
"device_id": 48104,
"item": "barometric_pressure",
"sort": 5,
"station_id": 13797,
"station_item_id": 117046
},
{
"location_item_id": 210509,
"location_id": 13797,
"device_id": 82405,
"item": "barometric_pressure",
"sort": 10,
"station_id": 13797,
"station_item_id": 210509
},
{
"location_item_id": 117057,
"location_id": 13797,
"device_id": 48104,
"item": "diagnostics",
"sort": 6,
"station_id": 13797,
"station_item_id": 117057
},
{
"location_item_id": 117058,
"location_id": 13797,
"device_id": 48106,
"item": "diagnostics",
"sort": 7,
"station_id": 13797,
"station_item_id": 117058
},
{
"location_item_id": 210510,
"location_id": 13797,
"device_id": 82405,
"item": "diagnostics",
"sort": 8,
"station_id": 13797,
"station_item_id": 210510
},
{
"location_item_id": 117056,
"location_id": 13797,
"device_id": 48094,
"item": "diagnostics",
"sort": 11,
"station_id": 13797,
"station_item_id": 117056
},
{
"location_item_id": 117029,
"location_id": 13797,
"item": "forecast",
"sort": 12,
"station_id": 13797,
"station_item_id": 117029
},
{
"location_item_id": 117051,
"location_id": 13797,
"device_id": 48106,
"item": "light",
"sort": 3,
"station_id": 13797,
"station_item_id": 117051
},
{
"location_item_id": 117045,
"location_id": 13797,
"device_id": 48104,
"item": "lightning",
"sort": 9,
"station_id": 13797,
"station_item_id": 117045
},
{
"location_item_id": 210508,
"location_id": 13797,
"device_id": 82405,
"item": "lightning",
"sort": 11,
"station_id": 13797,
"station_item_id": 210508
},
{
"location_item_id": 117050,
"location_id": 13797,
"device_id": 48106,
"item": "rain",
"sort": 4,
"station_id": 13797,
"station_item_id": 117050
},
{
"location_item_id": 117052,
"location_id": 13797,
"device_id": 48106,
"item": "wind",
"sort": 2,
"station_id": 13797,
"station_item_id": 117052
}
],
"is_local_mode": false
}
],
"status": {
"status_code": 0,
"status_message": "SUCCESS"
}
}
If I then query for the observations of the separate device_ids directly with the /observations/devices/device_id endpoint it returns the correct data for each item.
{
"status": {
"status_code": 0,
"status_message": "SUCCESS"
},
"device_id": 82405,
"type": "obs_air",
"source": "cache",
"summary": {
"pressure_trend": "rising",
"strike_count_1h": 0,
"strike_count_3h": 0,
"strike_last_dist": 6,
"strike_last_epoch": 1631650440,
"feels_like": 20.4,
"heat_index": 20.4,
"wind_chill": 20.4
},
"obs": [
[
1632931779,
743,
20.4,
36,
0,
0,
2.88,
1
]
]
}
OK, that is a pitty. That will make implementing this a lot more complicated, as I will need to rewrite most of the IO module.
I could loop through the data from get/stations/station_id
and then call data for each Device ID, but in your case that would be at least 3 calls per cycle, if I save the device ids on startup.
I will flag this as an enhancement request, but it will not be done right now.
To make it simpler could just accept a station id or a device id. Then I can just manually add 3 instances with different device ids.
I am in the process of writing a completely new Integration for WeatherFlow, using the REST API. I have a working version now, without support for this, but it made me think if I couldn't do it completely different, now that I am rewriting anyway. So stay tuned, I hope I can have a working version within a week or so that basically uses the attached devices to get the data, and creates a HA Device for each Device attached to a Hub.
Our station has two sensors connected, one indoor and one outdoor. Only the outdoor sensor is returning temperature data. Is it possible to return data for all available sensors? Thanks