Skip to content

Commit

Permalink
add tests for WS90 rain state detection
Browse files Browse the repository at this point in the history
  • Loading branch information
dkadioglu committed Oct 6, 2024
1 parent b95d06b commit bc53bea
Show file tree
Hide file tree
Showing 2 changed files with 398 additions and 0 deletions.
365 changes: 365 additions & 0 deletions tests/data/test_data_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from ecowitt2mqtt.helpers.calculator import CalculatedDataPoint, DataPointType
from ecowitt2mqtt.helpers.calculator.battery import BooleanBatteryState
from ecowitt2mqtt.helpers.calculator.leak import LeakState
from ecowitt2mqtt.helpers.calculator.rainstate import RainState
from ecowitt2mqtt.helpers.calculator.temperature import (
FrostRisk,
HumidexPerception,
Expand Down Expand Up @@ -2972,6 +2973,370 @@ def test_precision(device_data: dict[str, Any], ecowitt: Ecowitt) -> None:
),
},
),
(
"payload_gw2000a_3.json",
{
"ws90_ver": CalculatedDataPoint(
data_point_key="ws90_ver",
value=147.0,
unit=None,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"runtime": CalculatedDataPoint(
"runtime",
1574073.0,
unit=UnitOfTime.SECONDS,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"tempin": CalculatedDataPoint(
"temp",
71.78,
unit=UnitOfTemperature.FAHRENHEIT,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"humidityin": CalculatedDataPoint(
"humidity",
59.0,
unit=PERCENTAGE,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"baromrel": CalculatedDataPoint(
"barom",
30.035,
unit=UnitOfPressure.INHG,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"baromabs": CalculatedDataPoint(
"barom",
29.394,
unit=UnitOfPressure.INHG,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"temp": CalculatedDataPoint(
"temp",
51.44,
unit=UnitOfTemperature.FAHRENHEIT,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"humidity": CalculatedDataPoint(
"humidity",
76.0,
unit=PERCENTAGE,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"winddir": CalculatedDataPoint(
"winddir",
181.0,
unit=DEGREE,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"windspeed": CalculatedDataPoint(
"wind",
1.79,
unit=UnitOfSpeed.MILES_PER_HOUR,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"windgust": CalculatedDataPoint(
"gust",
4.25,
unit=UnitOfSpeed.MILES_PER_HOUR,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"maxdailygust": CalculatedDataPoint(
"gust",
12.75,
unit=UnitOfSpeed.MILES_PER_HOUR,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"solarradiation": CalculatedDataPoint(
"solarradiation",
0.00,
unit=UnitOfIlluminance.WATTS_PER_SQUARE_METER,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"solarradiation_perceived": CalculatedDataPoint(
"solarradiation_perceived",
0.0,
unit=PERCENTAGE,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"uv": CalculatedDataPoint(
"uv",
0.0,
unit=UV_INDEX,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"safe_exposure_time_skin_type_1": CalculatedDataPoint(
"safe_exposure_time_skin_type_1",
None,
unit=UnitOfTime.MINUTES,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"safe_exposure_time_skin_type_2": CalculatedDataPoint(
"safe_exposure_time_skin_type_2",
None,
unit=UnitOfTime.MINUTES,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"safe_exposure_time_skin_type_3": CalculatedDataPoint(
"safe_exposure_time_skin_type_3",
None,
unit=UnitOfTime.MINUTES,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"safe_exposure_time_skin_type_4": CalculatedDataPoint(
"safe_exposure_time_skin_type_4",
None,
unit=UnitOfTime.MINUTES,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"safe_exposure_time_skin_type_5": CalculatedDataPoint(
"safe_exposure_time_skin_type_5",
None,
unit=UnitOfTime.MINUTES,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"safe_exposure_time_skin_type_6": CalculatedDataPoint(
"safe_exposure_time_skin_type_6",
None,
unit=UnitOfTime.MINUTES,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"rrain_piezo": CalculatedDataPoint(
"rrain_piezo",
0.000,
unit=UnitOfPrecipitationRate.INCHES_PER_HOUR,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"erain_piezo": CalculatedDataPoint(
"rain_piezo",
0.000,
unit=UnitOfAccumulatedPrecipitation.INCHES,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"hrain_piezo": CalculatedDataPoint(
"rain_piezo",
0.000,
unit=UnitOfAccumulatedPrecipitation.INCHES,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"drain_piezo": CalculatedDataPoint(
"rain_piezo",
0.000,
unit=UnitOfAccumulatedPrecipitation.INCHES,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"wrain_piezo": CalculatedDataPoint(
"rain_piezo",
0.181,
unit=UnitOfAccumulatedPrecipitation.INCHES,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"mrain_piezo": CalculatedDataPoint(
"rain_piezo",
0.094,
unit=UnitOfAccumulatedPrecipitation.INCHES,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"yrain_piezo": CalculatedDataPoint(
"rain_piezo",
23.264,
unit=UnitOfAccumulatedPrecipitation.INCHES,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"srain_piezo": CalculatedDataPoint(
"rain_piezo",
RainState.OFF,
unit=None,
attributes={},
data_type=DataPointType.BOOLEAN,
),
"ws90cap_volt": CalculatedDataPoint(
"volt",
5.0,
unit=UnitOfElectricPotential.VOLT,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"wh90batt": CalculatedDataPoint(
"batt",
3.04,
unit=UnitOfElectricPotential.VOLT,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"dewpoint": CalculatedDataPoint(
"dewpoint",
44.138051751285005,
unit=UnitOfTemperature.FAHRENHEIT,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"feelslike": CalculatedDataPoint(
"feelslike",
51.44,
unit=UnitOfTemperature.FAHRENHEIT,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"heatindex": CalculatedDataPoint(
"heatindex",
49.856,
unit=UnitOfTemperature.FAHRENHEIT,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"windchill": CalculatedDataPoint(
"windchill",
None,
unit=UnitOfTemperature.FAHRENHEIT,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"humidityabs": CalculatedDataPoint(
data_point_key="humidityabs",
value=0.00046879579655827896,
unit=UnitOfVolume.POUNDS_PER_CUBIC_FOOT,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"humidityabsin": CalculatedDataPoint(
data_point_key="humidityabsin",
value=0.0007189508337053066,
unit=UnitOfVolume.POUNDS_PER_CUBIC_FOOT,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"thermalperception": CalculatedDataPoint(
data_point_key="thermalperception",
value=ThermalPerception.DRY,
unit=None,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"frostpoint": CalculatedDataPoint(
data_point_key="frostpoint",
value=41.677551623349345,
unit=UnitOfTemperature.FAHRENHEIT,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"frostrisk": CalculatedDataPoint(
data_point_key="frostrisk",
value=FrostRisk.NO_RISK,
unit=None,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"simmerindex": CalculatedDataPoint(
data_point_key="simmerindex",
value=None,
unit=UnitOfTemperature.FAHRENHEIT,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"simmerzone": CalculatedDataPoint(
data_point_key="simmerzone",
value=None,
unit=None,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"beaufortscale": CalculatedDataPoint(
data_point_key="beaufortscale",
value=1,
unit=None,
attributes={
"description": "Light air",
"sea_conditions": (
"Ripples with appearance of scales are formed, without "
"foam crests"
),
"land_conditions": (
"Direction shown by smoke drift but not by wind vanes"
),
},
data_type=DataPointType.NON_BOOLEAN,
),
"humidex": CalculatedDataPoint(
data_point_key="humidex",
value=11,
unit=None,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"humidex_perception": CalculatedDataPoint(
data_point_key="humidex_perception",
value=HumidexPerception.COMFORTABLE,
unit=None,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"relative_strain_index": CalculatedDataPoint(
data_point_key="relative_strain_index",
value=None,
unit=None,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"relative_strain_index_perception": CalculatedDataPoint(
data_point_key="relative_strain_index_perception",
value=None,
unit=None,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"heap": CalculatedDataPoint(
data_point_key="heap",
value=156456.0,
unit=UnitOfMemory.BYTES,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"winddir_name": CalculatedDataPoint(
data_point_key="winddir_name",
value="S",
unit=None,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
"interval": CalculatedDataPoint(
data_point_key="interval",
value=16.0,
unit=UnitOfTime.SECONDS,
attributes={},
data_type=DataPointType.NON_BOOLEAN,
),
},
),
(
"payload_gw2000a_2.json",
{
Expand Down
Loading

0 comments on commit bc53bea

Please sign in to comment.