Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
335 changes: 177 additions & 158 deletions packages/control/consumer/consumer.py

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions packages/control/consumer/consumer_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

@dataclass
class EcoCharging:
price_limit: float = 0.07
price_limit: float = 0.0002


@dataclass
Expand Down Expand Up @@ -125,7 +125,7 @@ class ConsumerConfig:
phase_1: int = 1
max_power: float = 5000
min_current: float = 0.5
min_intervall: int = 60
min_interval: int = 60


@dataclass
Expand Down Expand Up @@ -158,6 +158,7 @@ class Set:
target_current: float = 0
charge_state_prev: bool = False
log: Log = field(default_factory=lambda: Log())
on_time: float = field(default=0, metadata={"topic": "set/on_time"})
power: Optional[float] = None
timestamp_last_current_set: float = field(default=0, metadata={"topic": "set/timestamp_last_current_set"})
wait_for_start_state: WaitForStartStates = field(
Expand Down
1 change: 1 addition & 0 deletions packages/helpermodules/setdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -1250,6 +1250,7 @@ def process_consumer_topic(self, msg):
elif (re.search("consumer/[0-9]+/get/power$", msg.topic) is not None or
re.search("consumer/[0-9]+/set/power$", msg.topic) is not None or
re.search("consumer/[0-9]+/set/current$", msg.topic) is not None or
re.search("consumer/[0-9]+/set/on_time$", msg.topic) is not None or
re.search("consumer/[0-9]+/set/plug_time$", msg.topic) is not None or
re.search("consumer/[0-9]+/set/timestamp_last_current_set$", msg.topic) is not None or
re.search("consumer/[0-9]+/get/set_power$", msg.topic) is not None):
Expand Down
3 changes: 1 addition & 2 deletions packages/helpermodules/timecheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def is_timeframe_valid(now: datetime.datetime, begin: datetime.datetime, end: da
def check_end_time(plan: Union[ContinuousScheduledPlanConsumer,
ScheduledChargingPlan,
SuspendableScheduledPlanConsumer],
buffer: Optional[float]) -> Optional[float]:
buffer: Optional[float]) -> float:
""" gibt die verbleibende Zeit in Sekunden zurück.

Return
Expand All @@ -127,7 +127,6 @@ def check_end_time(plan: Union[ContinuousScheduledPlanConsumer,
"""
now = datetime.datetime.today()
end = datetime.datetime.strptime(plan.time, '%H:%M')
remaining_time = None
if plan.frequency.selected == "once":
endDate = datetime.datetime.strptime(plan.frequency.once, "%Y-%m-%d")
end = end.replace(endDate.year, endDate.month, endDate.day)
Expand Down
1 change: 1 addition & 0 deletions packages/helpermodules/update_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ class UpdateConfig:
"^openWB/consumer/[0-9]+/get/state_str$",
"^openWB/consumer/[0-9]+/get/voltages$",
"^openWB/consumer/[0-9]+/set/current$",
"^openWB/consumer/[0-9]+/set/on_time$",
"^openWB/consumer/[0-9]+/set/phases_to_use$",
"^openWB/consumer/[0-9]+/set/plug_time$",
"^openWB/consumer/[0-9]+/set/timestamp_last_current_set$",
Expand Down
3 changes: 1 addition & 2 deletions packages/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,7 @@ def handler_midnight(self):
f.write("")
with ChangedValuesContext(loadvars_.event_module_update_completed):
for consumer in data.data.consumer_data.values():
consumer.reset_wait_for_start()
consumer.reset_chargemode_at_midnight()
consumer.midnight_handler()
except Exception:
log.exception("Fehler im Main-Modul")

Expand Down
Loading