Skip to content

Commit

Permalink
"Neu" statt "Standard-"
Browse files Browse the repository at this point in the history
  • Loading branch information
LKuemmel committed May 28, 2024
1 parent f788a5c commit 92f328a
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 23 deletions.
2 changes: 1 addition & 1 deletion packages/control/chargepoint/chargepoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

def get_chargepoint_config_default() -> dict:
return {
"name": "Standard-Ladepunkt",
"name": "neuer Ladepunkt",
"type": None,
"ev": 0,
"template": 0,
Expand Down
2 changes: 1 addition & 1 deletion packages/control/chargepoint/chargepoint_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class Set:
class Config:
configuration: Dict = field(default_factory=empty_dict_factory)
ev: int = 0
name: str = "Standard-Ladepunkt"
name: str = "neuer Ladepunkt"
type: Optional[str] = None
template: int = 0
connected_phases: int = 3
Expand Down
2 changes: 1 addition & 1 deletion packages/control/chargepoint/chargepoint_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class CpTemplateData:
id: int = 0
max_current_multi_phases: int = 32
max_current_single_phase: int = 32
name: str = "Standard Ladepunkt-Profil"
name: str = "neues Ladepunkt-Profil"
rfid_enabling: bool = False
valid_tags: List = field(default_factory=empty_list_factory)

Expand Down
17 changes: 12 additions & 5 deletions packages/control/ev.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,25 @@ def get_vehicle_default() -> dict:
return {
"charge_template": 0,
"ev_template": 0,
"name": "Standard-Fahrzeug",
"name": "neues Fahrzeug",
"tag_id": [],
"get/soc": 0
}


def get_charge_template_default() -> dict:
def get_new_charge_template() -> dict:
ct_default = asdict(ChargeTemplateData())
ct_default["chargemode"]["scheduled_charging"].pop("plans")
ct_default["time_charging"].pop("plans")
return ct_default


def get_charge_template_default() -> dict:
ct_default = asdict(ChargeTemplateData(name="Lade-Profil"))
ct_default["chargemode"]["scheduled_charging"].pop("plans")
ct_default["time_charging"].pop("plans")
return ct_default

# Avoid anti-pattern: mutable default arguments


Expand Down Expand Up @@ -109,7 +116,7 @@ def et_factory() -> Et:

@dataclass
class ChargeTemplateData:
name: str = "Standard-Lade-Profil"
name: str = "neues Lade-Profil"
disable_after_unplug: bool = False
prio: bool = False
load_default: bool = False
Expand All @@ -120,7 +127,7 @@ class ChargeTemplateData:

@dataclass
class EvTemplateData:
name: str = "Standard-Fahrzeug-Profil"
name: str = "neues Fahrzeug-Profil"
max_current_multi_phases: int = 16
max_phases: int = 3
phase_switch_pause: int = 2
Expand Down Expand Up @@ -182,7 +189,7 @@ class EvData:
set: Set = field(default_factory=set_factory)
charge_template: int = 0
ev_template: int = 0
name: str = "Standard-Fahrzeug"
name: str = "neues Fahrzeug"
tag_id: List[str] = field(default_factory=empty_list_factory)
get: Get = field(default_factory=get_factory)

Expand Down
12 changes: 6 additions & 6 deletions packages/control/ev_charge_template_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,24 @@ def data_module() -> None:
pytest.param({"0": TimeChargingPlan()}, 0, 0, None,
(0, "stop", ChargeTemplate.TIME_CHARGING_NO_PLAN_ACTIVE, None), id="no plan active"),
pytest.param({"0": TimeChargingPlan()}, 0, 0, TimeChargingPlan(),
(16, "time_charging", None, "Zeitladen-Standard"), id="plan active"),
(16, "time_charging", None, "neuer Zeitladen-Plan"), id="plan active"),
pytest.param({"0": TimeChargingPlan(limit=Limit(selected="soc"))}, 100, 0,
TimeChargingPlan(limit=Limit(selected="soc")),
(0, "stop", ChargeTemplate.TIME_CHARGING_SOC_REACHED, "Zeitladen-Standard"),
(0, "stop", ChargeTemplate.TIME_CHARGING_SOC_REACHED, "neuer Zeitladen-Plan"),
id="plan active, soc is reached"),
pytest.param({"0": TimeChargingPlan(limit=Limit(selected="soc"))}, 40, 0,
TimeChargingPlan(limit=Limit(selected="soc")),
(16, "time_charging", None, "Zeitladen-Standard"), id="plan active, soc is not reached"),
(16, "time_charging", None, "neuer Zeitladen-Plan"), id="plan active, soc is not reached"),
pytest.param({"0": TimeChargingPlan(limit=Limit(selected="soc"))}, None, 0,
TimeChargingPlan(limit=Limit(selected="soc")),
(16, "time_charging", None, "Zeitladen-Standard"), id="plan active, soc is not defined"),
(16, "time_charging", None, "neuer Zeitladen-Plan"), id="plan active, soc is not defined"),
pytest.param({"0": TimeChargingPlan(limit=Limit(selected="amount"))}, 0, 1500,
TimeChargingPlan(limit=Limit(selected="amount")),
(0, "stop", ChargeTemplate.TIME_CHARGING_AMOUNT_REACHED, "Zeitladen-Standard"),
(0, "stop", ChargeTemplate.TIME_CHARGING_AMOUNT_REACHED, "neuer Zeitladen-Plan"),
id="plan active, used_amount_time_charging is reached"),
pytest.param({"0": TimeChargingPlan(limit=Limit(selected="amount"))}, 0, 500,
TimeChargingPlan(limit=Limit(selected="amount")),
(16, "time_charging", None, "Zeitladen-Standard"),
(16, "time_charging", None, "neuer Zeitladen-Plan"),
id="plan active, used_amount_time_charging is not reached"),
pytest.param({"0": TimeChargingPlan()}, 0, 0, None,
(0, "stop", ChargeTemplate.TIME_CHARGING_NO_PLAN_ACTIVE, None), id="plan defined but not found"),
Expand Down
6 changes: 3 additions & 3 deletions packages/helpermodules/abstract_plans.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,18 @@ class TimeframePlan(PlanBase):
@dataclass
class ScheduledChargingPlan(PlanBase):
current: int = 14
name: str = "Zielladen-Standard"
name: str = "neuer Zielladen-Plan"
limit: ScheduledLimit = field(default_factory=scheduled_limit_factory)
time: str = "07:00" # ToDo: aktuelle Zeit verwenden


@dataclass
class TimeChargingPlan(TimeframePlan):
name: str = "Zeitladen-Standard"
name: str = "neuer Zeitladen-Plan"
current: int = 16
limit: Limit = field(default_factory=limit_factory)


@dataclass
class AutolockPlan(TimeframePlan):
name: str = "Standard Autolock-Plan"
name: str = "neuer Autolock-Plan"
2 changes: 1 addition & 1 deletion packages/helpermodules/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def addChargeTemplate(self, connection_id: str, payload: dict) -> None:
""" sendet das Topic, zu dem ein neues Lade-Profil erstellt werden soll.
"""
new_id = self.max_id_charge_template + 1
charge_template_default = ev.get_charge_template_default()
charge_template_default = ev.get_new_charge_template()
Pub().pub("openWB/set/vehicle/template/charge_template/" +
str(new_id), charge_template_default)
self.max_id_charge_template = new_id
Expand Down
6 changes: 3 additions & 3 deletions packages/helpermodules/measurement_logging/write_log_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ def test_get_names(daily_log_totals, monkeypatch):
assert names == {'bat2': "Speicher",
'counter0': "Zähler",
'cp3': "cp3",
'cp4': "Standard-Ladepunkt",
'cp5': "Standard-Ladepunkt",
'cp6': "Standard-Ladepunkt",
'cp4': "neuer Ladepunkt",
'cp5': "neuer Ladepunkt",
'cp6': "neuer Ladepunkt",
'pv1': "Wechselrichter",
"sh1": "Smarthome1"}

Expand Down
4 changes: 2 additions & 2 deletions packages/helpermodules/update_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,14 +409,14 @@ class UpdateConfig:
("openWB/chargepoint/template/0", get_chargepoint_template_default()),
("openWB/counter/get/hierarchy", []),
("openWB/counter/config/reserve_for_not_charging", counter_all.Config().reserve_for_not_charging),
("openWB/vehicle/0/name", ev.EvData().name),
("openWB/vehicle/0/name", "Standard-Fahrzeug"),
("openWB/vehicle/0/charge_template", ev.Ev(0).charge_template.ct_num),
("openWB/vehicle/0/soc_module/config", NO_MODULE),
("openWB/vehicle/0/soc_module/general_config", dataclass_utils.asdict(GeneralVehicleConfig())),
("openWB/vehicle/0/ev_template", ev.Ev(0).ev_template.et_num),
("openWB/vehicle/0/tag_id", ev.Ev(0).data.tag_id),
("openWB/vehicle/0/get/soc", ev.Ev(0).data.get.soc),
("openWB/vehicle/template/ev_template/0", asdict(ev.EvTemplateData(min_current=10))),
("openWB/vehicle/template/ev_template/0", asdict(ev.EvTemplateData(name="Fahrzeug-Profil", min_current=10))),
("openWB/vehicle/template/charge_template/0", ev.get_charge_template_default()),
("openWB/general/chargemode_config/instant_charging/phases_to_use", 3),
("openWB/general/chargemode_config/pv_charging/bat_mode", BatConsiderationMode.EV_MODE.value),
Expand Down

0 comments on commit 92f328a

Please sign in to comment.