Skip to content

Commit

Permalink
Merge pull request #7 from briis/0.6.4-branch
Browse files Browse the repository at this point in the history
0.6.4 branch
  • Loading branch information
briis authored Oct 18, 2023
2 parents ccdc2ec + f0fc518 commit 3dfae0b
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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`
Expand Down
1 change: 1 addition & 0 deletions async_test_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion pyweatherflow_forecast/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
)

__title__ = "pyweatherflow_forecast"
__version__ = "0.6.3"
__version__ = "0.6.4"
__author__ = "briis"
__license__ = "MIT"
32 changes: 32 additions & 0 deletions pyweatherflow_forecast/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setuptools.setup(
name="pyweatherflow-forecast",
version="0.6.3",
version="0.6.4",
author="briis",
author_email="[email protected]",
description="Gets the weather forecast data from WeatherFlow",
Expand Down

0 comments on commit 3dfae0b

Please sign in to comment.