diff --git a/custom_components/sws12500/const.py b/custom_components/sws12500/const.py index a3c3a42..1819c7f 100644 --- a/custom_components/sws12500/const.py +++ b/custom_components/sws12500/const.py @@ -68,6 +68,10 @@ WIND_GUST: Final = "wind_gust" WIND_DIR: Final = "wind_dir" WIND_AZIMUT: Final = "wind_azimut" RAIN: Final = "rain" +HOURLY_RAIN: Final = "hourly_rain" +WEEKLY_RAIN: Final = "weekly_rain" +MONTHLY_RAIN: Final = "monthly_rain" +YEARLY_RAIN: Final = "yearly_rain" DAILY_RAIN: Final = "daily_rain" SOLAR_RADIATION: Final = "solar_radiation" INDOOR_TEMP: Final = "indoor_temp" @@ -129,15 +133,15 @@ REMAP_WSLINK_ITEMS: dict = { "t234c2cn": CH3_CONNECTION, "t1chill": CHILL_INDEX, "t1heat": HEAT_INDEX, + "t1rainhr": HOURLY_RAIN, + "t1rainwy": WEEKLY_RAIN, + "t1rainmth": MONTHLY_RAIN, + "t1rainyr": YEARLY_RAIN, } # TODO: Add more sensors # # 'inbat' indoor battery level (1 normal, 0 low) -# 't1rainhr' hourly rain rate in mm -# 't1rainwy' weekly rain rate in mm -# 't1rainmth': monthly rain rate in mm -# 't1rainyr': yearly rain rate in mm # 't1bat': outdoor battery level (1 normal, 0 low) # 't234c1bat': CH2 battery level (1 normal, 0 low) CH2 in integration is CH1 in WSLink diff --git a/custom_components/sws12500/manifest.json b/custom_components/sws12500/manifest.json index c1aa0c4..56461c7 100644 --- a/custom_components/sws12500/manifest.json +++ b/custom_components/sws12500/manifest.json @@ -10,6 +10,6 @@ "issue_tracker": "https://github.com/schizza/SWS-12500-custom-component/issues", "requirements": [], "ssdp": [], - "version": "1.5.3", + "version": "1.6.2", "zeroconf": [] } diff --git a/custom_components/sws12500/sensors_wslink.py b/custom_components/sws12500/sensors_wslink.py index 92cfe03..d052c42 100644 --- a/custom_components/sws12500/sensors_wslink.py +++ b/custom_components/sws12500/sensors_wslink.py @@ -39,6 +39,10 @@ from .const import ( WIND_GUST, WIND_SPEED, UnitOfDir, + MONTHLY_RAIN, + HOURLY_RAIN, + YEARLY_RAIN, + HOURLY_RAIN, ) from .sensors_common import WeatherSensorEntityDescription from .utils import wind_dir_to_text @@ -138,10 +142,10 @@ SENSOR_TYPES_WSLINK: tuple[WeatherSensorEntityDescription, ...] = ( ), WeatherSensorEntityDescription( key=RAIN, - native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS, + native_unit_of_measurement=UnitOfVolumetricFlux.MILLIMETERS_PER_HOUR, device_class=SensorDeviceClass.PRECIPITATION, state_class=SensorStateClass.TOTAL, - suggested_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS, + suggested_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS_PER_HOUR, suggested_display_precision=2, icon="mdi:weather-pouring", translation_key=RAIN, @@ -158,6 +162,50 @@ SENSOR_TYPES_WSLINK: tuple[WeatherSensorEntityDescription, ...] = ( translation_key=DAILY_RAIN, value_fn=lambda data: cast("float", data), ), + WeatherSensorEntityDescription( + key=HOURLY_RAIN, + native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS, + device_class=SensorDeviceClass.PRECIPITATION, + state_class=SensorStateClass.MEASUREMENT, + suggested_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS, + suggested_display_precision=2, + icon="mdi:weather-pouring", + translation_key=DAILY_RAIN, + value_fn=lambda data: cast("float", data), + ), + WeatherSensorEntityDescription( + key=WEEKLY_RAIN, + native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS, + device_class=SensorDeviceClass.PRECIPITATION, + state_class=SensorStateClass.MEASUREMENT, + suggested_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS, + suggested_display_precision=2, + icon="mdi:weather-pouring", + translation_key=DAILY_RAIN, + value_fn=lambda data: cast("float", data), + ), + WeatherSensorEntityDescription( + key=MONTHLY_RAIN, + native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS, + device_class=SensorDeviceClass.PRECIPITATION, + state_class=SensorStateClass.MEASUREMENT, + suggested_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS, + suggested_display_precision=2, + icon="mdi:weather-pouring", + translation_key=DAILY_RAIN, + value_fn=lambda data: cast("float", data), + ), + WeatherSensorEntityDescription( + key=YEARLY_RAIN, + native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS, + device_class=SensorDeviceClass.PRECIPITATION, + state_class=SensorStateClass.MEASUREMENT, + suggested_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS, + suggested_display_precision=2, + icon="mdi:weather-pouring", + translation_key=DAILY_RAIN, + value_fn=lambda data: cast("float", data), + ), WeatherSensorEntityDescription( key=SOLAR_RADIATION, native_unit_of_measurement=UnitOfIrradiance.WATTS_PER_SQUARE_METER, diff --git a/custom_components/sws12500/translations/cs.json b/custom_components/sws12500/translations/cs.json index 24bf2f5..e024ec3 100644 --- a/custom_components/sws12500/translations/cs.json +++ b/custom_components/sws12500/translations/cs.json @@ -112,6 +112,10 @@ "ch4_humidity": { "name": "Vlhkost sensoru 4" }, "heat_index": { "name": "Tepelný index" }, "chill_index": { "name": "Pocitová teplota" }, + "hourly_rain": { "name": "Hodinový úhrn srážek" }, + "weekly_rain": { "name": "Týdenní úhrn srážek" }, + "monthly_rain": { "name": "Měsíční úhrn srážek" }, + "yearly_rain": { "name": "Roční úhrn srážek" }, "wind_azimut": { "name": "Azimut", "state": { diff --git a/custom_components/sws12500/translations/en.json b/custom_components/sws12500/translations/en.json index 0115968..e0ce1a6 100644 --- a/custom_components/sws12500/translations/en.json +++ b/custom_components/sws12500/translations/en.json @@ -35,7 +35,6 @@ }, "step": { - "init": { "title": "Configure SWS12500 Integration", "description": "Choose what do you want to configure. If basic access or resending data for Windy site", @@ -83,8 +82,8 @@ "trigger_action": "Trigger migration" }, "data_description": { - "sensor_to_migrate": "Select the correct sensor for statistics migration.\nThe sensor values will be preserved, they will not be recalculated, only the unit in the long-term statistics will be changed.", - "trigger_action": "Trigger the sensor statistics migration after checking." + "sensor_to_migrate": "Select the correct sensor for statistics migration.\nThe sensor values will be preserved, they will not be recalculated, only the unit in the long-term statistics will be changed.", + "trigger_action": "Trigger the sensor statistics migration after checking." } } } @@ -113,6 +112,10 @@ "ch4_humidity": { "name": "Channel 4 humidity" }, "heat_index": { "name": "Apparent temperature" }, "chill_index": { "name": "Wind chill" }, + "hourly_rain": { "name": "Hourly precipitation" }, + "weekly_rain": { "name": "Weekly precipitation" }, + "monthly_rain": { "name": "Monthly precipitation" }, + "yearly_rain": { "name": "Yearly precipitation" }, "wind_azimut": { "name": "Bearing", "state": {