diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b1d08a..1577c6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## Release 0.6.4 + +**Date**: `NOT RELEASED` + +### Changes + +- Added new sensor `Power Save Mode` that shows the Power Mode of a Tempest device. Attributes of the sensor gives a textual explanation. For more information [read here](https://help.weatherflow.com/hc/en-us/articles/360048877194-Solar-Power-Rechargeable-Battery) + ## Release 0.6.3 **Date**: `2023-10-17` diff --git a/async_test_module.py b/async_test_module.py index b91582e..f146671 100644 --- a/async_test_module.py +++ b/async_test_module.py @@ -62,6 +62,7 @@ async def main() -> None: print("FREEZING ALT: ", sensor_data.freezing_altitude) print("VOLTAGE: ", sensor_data.voltage) print("BATTERY: ", sensor_data.battery) + print("POWER SAVE MODE: ", sensor_data.power_save_mode) cnt += 1 diff --git a/pyweatherflow_forecast/__init__.py b/pyweatherflow_forecast/__init__.py index bc2c3b7..ff1ce5e 100644 --- a/pyweatherflow_forecast/__init__.py +++ b/pyweatherflow_forecast/__init__.py @@ -17,6 +17,6 @@ ) __title__ = "pyweatherflow_forecast" -__version__ = "0.6.3" +__version__ = "0.6.4" __author__ = "briis" __license__ = "MIT" diff --git a/pyweatherflow_forecast/data.py b/pyweatherflow_forecast/data.py index dd433e7..a6378e8 100644 --- a/pyweatherflow_forecast/data.py +++ b/pyweatherflow_forecast/data.py @@ -667,6 +667,38 @@ def lightning_strike_last_epoch(self) -> datetime.timestamp: """Last lightning strike epoch time.""" return self._lightning_strike_last_epoch + @property + def power_save_mode(self) -> int: + """Power Save Mode (Tempest devices).""" + if self._voltage is None or self._solar_radiation is None: + return None + + _power_save_mode = None + if self._voltage >= 2.455: + _power_save_mode = 0 + elif self._voltage <= 2.355: + _power_save_mode = 3 + elif self._solar_radiation > 100: + # Assume charging and Voltage is increasing + if self._voltage >= 2.41: + _power_save_mode = 1 + elif self._voltage > 2.375: + _power_save_mode = 2 + else: + _power_save_mode = 3 + else: + # Assume discharging and voltage is decreasing + if self._voltage > 2.415: + _power_save_mode = 0 + elif self._voltage > 2.39: + _power_save_mode = 1 + elif self._voltage > 2.355: + _power_save_mode = 2 + else: + _power_save_mode = 3 + + return _power_save_mode + @property def precip(self) -> float: """Precipitation.""" diff --git a/setup.py b/setup.py index bb9307a..a4bea0c 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setuptools.setup( name="pyweatherflow-forecast", - version="0.6.3", + version="0.6.4", author="briis", author_email="bjarne@briis.com", description="Gets the weather forecast data from WeatherFlow",