Skip to content

Commit

Permalink
Merge branch 'main' into develop
Browse files Browse the repository at this point in the history
# Conflicts:
#	custom_components/peaqev/manifest.json
#	custom_components/peaqev/peaqservice/chargertypes/types/zaptec.py
  • Loading branch information
magnuselden authored and magnuselden committed Dec 10, 2023
2 parents fc9c242 + 2a82e98 commit 71ebeb7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
11 changes: 7 additions & 4 deletions custom_components/peaqev/peaqservice/chargertypes/types/easee.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from custom_components.peaqev.peaqservice.util.constants import (CHARGER,
CHARGERID,
CURRENT)
from custom_components.peaqev.peaqservice.util.extensionmethods import log_once

_LOGGER = logging.getLogger(__name__)
# docs: https://github.com/fondberg/easee_hass
Expand Down Expand Up @@ -45,10 +44,13 @@ def __init__(
]
self.chargerstates[ChargeControllerStates.Charging] = ["charging"]
self.chargerstates[ChargeControllerStates.Done] = ["completed"]
self._easee_max_amps = None

@property
def max_amps(self) -> int:
return self.get_allowed_amps()
if self._easee_max_amps is None:
return self.get_allowed_amps()
return self._easee_max_amps

@property
def type(self) -> ChargerType:
Expand Down Expand Up @@ -145,10 +147,11 @@ def get_allowed_amps(self) -> int:
if state is not None:
retattr = state.attributes.get(entity[1], None)
if retattr is not None:
log_once(f"Got max amps from Easee. Setting {retattr}A.")
_LOGGER.info(f"Got max amps from Easee. Setting {retattr}A.")
ret = int(retattr)
self._easee_max_amps = ret
else:
log_once(
_LOGGER.warning(
f"Unable to get max amps. The sensor {self.entities.maxamps} returned state {ret}. Setting max amps to 16 til I get a proper state."
)
return ret
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def call_pause(self) -> CallType:
@property
def call_update_current(self) -> CallType:
"""not available from integration yet."""
pass

@property
def servicecalls_options(self) -> ServiceCallsOptions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __post_init__(self):
def _set_allowed_amps(self, amps_dict, default_amps) -> dict:
"""only allow amps if user has set this value high enough"""
if self.fuse_max > 0:
return {k: v for (k, v) in default_amps.items() if k < self.fuse_max}
return {k: v for (k, v) in amps_dict.items() if k < self.fuse_max}
return default_amps

@property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def log_once(msg):
try:
if msg not in already_logged:
already_logged.append(msg)
_LOGGER.debug(msg)
_LOGGER.info(msg)
except Exception as e:
_LOGGER.error(f"Error in log_once_per_minute: {e}")

Expand Down

0 comments on commit 71ebeb7

Please sign in to comment.