diff --git a/.gitignore b/.gitignore index 13b6f67..566cd66 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,8 @@ pythonenv* venv .venv .coverage +*.db* +*.log* +.HA_VERSION +config/.storage/* +config/blueprints/* diff --git a/custom_components/pirateweather/const.py b/custom_components/pirateweather/const.py index 6c00d1a..da0998e 100644 --- a/custom_components/pirateweather/const.py +++ b/custom_components/pirateweather/const.py @@ -116,6 +116,13 @@ "nearest_storm_bearing": "Nearest Storm Bearing", "alerts": "Alerts", "time": "Time", + "fire_index": "Fire Index", + "fire_index_max": "Fire Index Max", + "smoke": "Smoke", + "smoke_max": "Smoke Max", + "liquid_accumulation": "Liquid Accumulation", + "snow_accumulation": "Snow Accumulation", + "ice_accumulation": "Ice Accumulation", } LANGUAGES = [ diff --git a/custom_components/pirateweather/manifest.json b/custom_components/pirateweather/manifest.json index 52fb2dd..c73c9c8 100644 --- a/custom_components/pirateweather/manifest.json +++ b/custom_components/pirateweather/manifest.json @@ -1,12 +1,16 @@ { "domain": "pirateweather", "name": "Pirate Weather", - "codeowners": ["@alexander0042"], + "codeowners": [ + "@alexander0042" + ], "config_flow": true, - "dependencies": [], + "dependencies": [], "documentation": "https://github.com/alexander0042/pirate-weather-ha", "iot_class": "cloud_polling", - "issue_tracker": "https://github.com/alexander0042/pirate-weather-ha/issues", - "requirements": ["python-forecastio==1.4.0"], - "version": "1.4.5.1" -} + "issue_tracker": "https://github.com/alexander0042/pirate-weather-ha/issues", + "requirements": [ + "python-forecastio==1.4.0" + ], + "version": "1.5" +} \ No newline at end of file diff --git a/custom_components/pirateweather/sensor.py b/custom_components/pirateweather/sensor.py index dec84ab..0320a0a 100644 --- a/custom_components/pirateweather/sensor.py +++ b/custom_components/pirateweather/sensor.py @@ -26,6 +26,7 @@ from homeassistant.const import ( ATTR_ATTRIBUTION, + CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, CONF_API_KEY, CONF_LATITUDE, CONF_LONGITUDE, @@ -194,6 +195,45 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription): icon="mdi:weather-snowy", forecast_mode=["hourly", "daily"], ), + "liquid_accumulation": PirateWeatherSensorEntityDescription( + key="liquid_accumulation", + name="Liquid Accumulation", + device_class=SensorDeviceClass.PRECIPITATION, + si_unit=UnitOfLength.CENTIMETERS, + us_unit=UnitOfLength.INCHES, + ca_unit=UnitOfLength.CENTIMETERS, + uk_unit=UnitOfLength.CENTIMETERS, + uk2_unit=UnitOfLength.CENTIMETERS, + suggested_display_precision=4, + icon="mdi:weather-rainy", + forecast_mode=["hourly", "daily"], + ), + "snow_accumulation": PirateWeatherSensorEntityDescription( + key="snow_accumulation", + name="Snow Accumulation", + device_class=SensorDeviceClass.PRECIPITATION, + si_unit=UnitOfLength.CENTIMETERS, + us_unit=UnitOfLength.INCHES, + ca_unit=UnitOfLength.CENTIMETERS, + uk_unit=UnitOfLength.CENTIMETERS, + uk2_unit=UnitOfLength.CENTIMETERS, + suggested_display_precision=4, + icon="mdi:weather-snowy", + forecast_mode=["hourly", "daily"], + ), + "ice_accumulation": PirateWeatherSensorEntityDescription( + key="ice_accumulation", + name="Ice Accumulation", + device_class=SensorDeviceClass.PRECIPITATION, + si_unit=UnitOfLength.CENTIMETERS, + us_unit=UnitOfLength.INCHES, + ca_unit=UnitOfLength.CENTIMETERS, + uk_unit=UnitOfLength.CENTIMETERS, + uk2_unit=UnitOfLength.CENTIMETERS, + suggested_display_precision=4, + icon="mdi:weather-snowy-rainy", + forecast_mode=["hourly", "daily"], + ), "temperature": PirateWeatherSensorEntityDescription( key="temperature", name="Temperature", @@ -333,6 +373,48 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription): suggested_display_precision=2, forecast_mode=["currently", "hourly", "daily"], ), + "fire_index": PirateWeatherSensorEntityDescription( + key="fire_index", + name="Fire Index", + state_class=SensorStateClass.MEASUREMENT, + suggested_display_precision=2, + icon="mdi:fire", + forecast_mode=["currently", "hourly"], + ), + "fire_index_max": PirateWeatherSensorEntityDescription( + key="fire_index_max", + name="Fire Index Max", + state_class=SensorStateClass.MEASUREMENT, + suggested_display_precision=2, + icon="mdi:fire", + forecast_mode=["daily"], + ), + "smoke": PirateWeatherSensorEntityDescription( + key="smoke", + name="Smoke", + device_class=SensorDeviceClass.PM25, + si_unit=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, + us_unit=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, + ca_unit=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, + uk_unit=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, + uk2_unit=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, + suggested_display_precision=2, + icon="mdi:smoke", + forecast_mode=["currently", "hourly"], + ), + "smoke_max": PirateWeatherSensorEntityDescription( + key="smoke_max", + name="Smoke Max", + device_class=SensorDeviceClass.PM25, + si_unit=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, + us_unit=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, + ca_unit=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, + uk_unit=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, + uk2_unit=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, + suggested_display_precision=2, + icon="mdi:smoke", + forecast_mode=["daily"], + ), "apparent_temperature_max": PirateWeatherSensorEntityDescription( key="apparent_temperature_max", name="Daily High Apparent Temperature", @@ -1020,11 +1102,15 @@ def get_state(self, data): "apparent_temperature_max", "pressure", "ozone", + "fire_index", + "fire_index_max", "uv_index", "wind_speed", "wind_gust", "visibility", "nearest_storm_distance", + "smoke", + "smoke_max", ]: if roundingVal == 0: outState = int(round(state, roundingVal)) @@ -1033,6 +1119,9 @@ def get_state(self, data): elif self.type in [ "precip_accumulation", + "liquid_accumulation", + "snow_accumulation", + "ice_accumulation", "precip_intensity", "precip_intensity_max", ]: diff --git a/custom_components/pirateweather/weather_update_coordinator.py b/custom_components/pirateweather/weather_update_coordinator.py index bce315f..bde3e05 100644 --- a/custom_components/pirateweather/weather_update_coordinator.py +++ b/custom_components/pirateweather/weather_update_coordinator.py @@ -68,7 +68,7 @@ async def _get_pw_weather(self): + "?units=" + self.requested_units + "&extend=hourly" - + "&tz=precise" + + "&version=2" ) async with ( diff --git a/scripts/develop b/scripts/develop old mode 100644 new mode 100755 diff --git a/scripts/setup b/scripts/setup old mode 100644 new mode 100755