Skip to content

Commit

Permalink
19.6.1 #88
Browse files Browse the repository at this point in the history
  • Loading branch information
magnuselden authored and magnuselden committed Jan 3, 2024
1 parent 595f9b1 commit 4ae835b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion peaqevcore/models/hub/currentpeak.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import logging
from datetime import datetime
from .hubmember import HubMember
from ...services.locale.Locale import LocaleData
from statistics import mean
_LOGGER = logging.getLogger(__name__)

EXPORT_FACTOR = 0.9

class CurrentPeak(HubMember):
def __init__(self, data_type: type, initval, startpeaks:dict, options_use_history: bool = False):
def __init__(self, data_type: type, initval, startpeaks:dict, locale: LocaleData, options_use_history: bool = False):
self._options_peaks: dict = startpeaks
self._value = initval
self._history: dict[str, list[float|int]] = {}
self._locale: LocaleData|None = None
self._active: bool = options_use_history
super().__init__(data_type, initval)

Expand Down Expand Up @@ -54,6 +56,9 @@ async def async_update(self, peaks: list) -> None:
def update_history(self, peaks: list) -> None:
_key = self._make_key()
self._history[_key] = peaks
if self._locale:
if self._locale.data.query_model.get_currently_obeserved_peak() > min(peaks):
self._value = self._locale.data.query_model.observed_peak
self._value = self._get_peak()

def import_from_service(self, importdto: dict, current:bool = False) -> dict:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setuptools.setup(
name="peaqevcore",
version="19.6.0",
version="19.6.1",
author="Magnus Eldén",
description="Core types for peaqev car charging",
url="https://github.com/elden1337/peaqev-core",
Expand Down

0 comments on commit 4ae835b

Please sign in to comment.