Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
fetch-depth: 2

- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: "3.12"

Expand Down
486 changes: 262 additions & 224 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/fixtures/ws/websocket_messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
{"device_id":211522,"type":"obs_st","obs":[[1709130791,0.0,0.0,0.0,0.0,3.0,793.3,-9.4,92.0,7875.0,0.28,66.0,0.0,0.0,0.0,0.0,2.62,1.0,0.0,0.0,0.0,0.0]],"summary":{"pressure_trend":"rising","strike_count_1h":0,"strike_count_3h":0,"precip_total_1h":0.0,"strike_last_dist":26,"strike_last_epoch":1707346875,"precip_accum_local_yesterday":0.478541,"precip_accum_local_yesterday_final":1.126487,"precip_analysis_type_yesterday":1,"feels_like":-9.4,"heat_index":-9.4,"wind_chill":-9.4,"dew_point":-10.5,"wet_bulb_temperature":-9.7,"wet_bulb_globe_temperature":-9.2,"air_density":1.04779,"delta_t":0.3,"precip_minutes_local_day":0,"precip_minutes_local_yesterday":22},"source":"mqtt","serial_number":"ST-00084623","hub_sn":"HB-00068684","firmware_revision":172},
{"device_id":211522,"type":"obs_st","obs":[[1709130911,0.0,0.32,1.31,254.0,3.0,793.3,-9.4,92.0,9792.0,0.34,81.0,0.0,0.0,0.0,0.0,2.62,1.0,0.0,0.0,0.0,0.0]],"summary":{"pressure_trend":"rising","strike_count_1h":0,"strike_count_3h":0,"precip_total_1h":0.0,"strike_last_dist":26,"strike_last_epoch":1707346875,"precip_accum_local_yesterday":0.478541,"precip_accum_local_yesterday_final":1.126487,"precip_analysis_type_yesterday":1,"feels_like":-9.4,"heat_index":-9.4,"wind_chill":-9.4,"dew_point":-10.5,"wet_bulb_temperature":-9.7,"wet_bulb_globe_temperature":-9.1,"air_density":1.04779,"delta_t":0.3,"precip_minutes_local_day":0,"precip_minutes_local_yesterday":22},"source":"mqtt","serial_number":"ST-00084623","hub_sn":"HB-00068684","firmware_revision":172},
{"device_id":211522,"type":"obs_st","obs":[[1709132533,0.0,0.3,0.95,333.0,3.0,793.5,-8.8,89.0,37408.0,1.31,312.0,0.0,0.0,0.0,0.0,2.71,1.0,0.0,0.0,0.0,0.0]],"summary":{"pressure_trend":"rising","strike_count_1h":0,"strike_count_3h":0,"precip_total_1h":0.0,"strike_last_dist":26,"strike_last_epoch":1707346875,"precip_accum_local_yesterday":0.478541,"precip_accum_local_yesterday_final":1.126487,"precip_analysis_type_yesterday":1,"feels_like":-8.8,"heat_index":-8.8,"wind_chill":-8.8,"dew_point":-10.3,"wet_bulb_temperature":-9.3,"wet_bulb_globe_temperature":-7.2,"air_density":1.04568,"delta_t":0.5,"precip_minutes_local_day":0,"precip_minutes_local_yesterday":22},"source":"mqtt","serial_number":"ST-00084623","hub_sn":"HB-00068684","firmware_revision":172},
{"device_id":211522,"type":"obs_st","obs":[[1709132533,0.0,0.3,0.95,333.0,3.0,793.5,-8.8,89.0,37408.0,1.31,312.0,0.0,0.0,0.0,0.0,2.71,1.0,0.0,0.0,0.0,0.0]],"summary":{"strike_count_1h":0,"strike_count_3h":0,"precip_total_1h":0.0,"precip_accum_local_yesterday":0.478541,"precip_analysis_type_yesterday":1,"feels_like":-8.8,"heat_index":-8.8,"wind_chill":-8.8,"dew_point":-10.3,"wet_bulb_temperature":-9.3,"wet_bulb_globe_temperature":-7.2,"air_density":1.04568,"delta_t":0.5,"precip_minutes_local_day":0,"precip_minutes_local_yesterday":22},"source":"mqtt","serial_number":"ST-00084623","hub_sn":"HB-00068684","firmware_revision":172},
{"serial_number": "ST-00081234", "type": "evt_strike", "hub_sn": "HB-00061234", "evt": [1710383159, 13, -182, 1], "source": "enhanced", "device_id": 392412}

]
6 changes: 6 additions & 0 deletions tests/test_ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,16 @@ def test_websocket_messages(websocket_messages):
assert isinstance(msg4, ObservationTempestWS)
msg5 = WebsocketResponseBuilder.build_response(websocket_messages[5])
assert isinstance(msg5, ObservationTempestWS)
msg6 = WebsocketResponseBuilder.build_response(websocket_messages[6])
assert isinstance(msg6, ObservationTempestWS)

assert msg3.device_id == 211522
assert msg3.epoch == 1709130791

assert msg6.summary.strike_last_dist == None
assert msg6.summary.strike_last_epoch == None
assert msg6.summary.pressure_trend == None
assert msg6.summary.precip_accum_local_yesterday_final == None

def test_winds(websocket_winds):
for msg in websocket_winds:
Expand Down
10 changes: 5 additions & 5 deletions weatherflow4py/models/rest/device.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from dataclasses import dataclass
from typing import List, Union
from typing import List, Optional, Union

from dataclasses_json import dataclass_json

Expand All @@ -20,18 +20,18 @@
@dataclass_json
@dataclass
class Summary:
pressure_trend: str
strike_count_1h: int
strike_count_3h: int
precip_total_1h: float
strike_last_dist: int
strike_last_epoch: int
precip_accum_local_yesterday: float
precip_accum_local_yesterday_final: float
precip_analysis_type_yesterday: PrecipitationAnalysisType
feels_like: float
heat_index: float
wind_chill: float
pressure_trend: Optional[str] = None
precip_accum_local_yesterday_final: Optional[float] = None
strike_last_dist: Optional[int] = None
strike_last_epoch: Optional[int] = None


@dataclass_json
Expand Down
14 changes: 7 additions & 7 deletions weatherflow4py/models/rest/forecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,19 @@ def ha_icon(self) -> str:
Icon.FOGGY: "fog",
Icon.PARTLY_CLOUDY_DAY: "partlycloudy",
Icon.PARTLY_CLOUDY_NIGHT: "partlycloudy",
Icon.POSSIBLY_RAINY_DAY: "pouring",
Icon.POSSIBLY_RAINY_NIGHT: "pouring",
Icon.POSSIBLY_SLEET_DAY: "hail",
Icon.POSSIBLY_SLEET_NIGHT: "hail",
Icon.POSSIBLY_RAINY_DAY: "rainy",
Icon.POSSIBLY_RAINY_NIGHT: "rainy",
Icon.POSSIBLY_SLEET_DAY: "snowy-rainy",
Icon.POSSIBLY_SLEET_NIGHT: "snowy-rainy",
Icon.POSSIBLY_SNOW_DAY: "snowy",
Icon.POSSIBLY_SNOW_NIGHT: "snowy",
Icon.POSSIBLY_THUNDERSTORM_DAY: "lightning-rainy",
Icon.POSSIBLY_THUNDERSTORM_NIGHT: "lightning-rainy",
Icon.RAINY: "rainy",
Icon.SLEET: "hail",
Icon.SLEET: "snowy-rainy",
Icon.SNOW: "snowy",
Icon.THUNDERSTORM: "lightning",
Icon.WINDY: "windy-variant",
Icon.THUNDERSTORM: "lightning-rainy",
Icon.WINDY: "windy",
}
return icon_mapping.get(self, "exceptional")

Expand Down