From 3680350b7687fcb781cc48df1d01cafbbdaee820 Mon Sep 17 00:00:00 2001 From: Emacee Date: Sat, 1 Jul 2023 09:04:22 +0200 Subject: [PATCH] Update alfen.py Convert 'change phase switching' value to string. Instead of 0 / 1 value it's now disabled / enabled. --- custom_components/alfen_wallbox/alfen.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/custom_components/alfen_wallbox/alfen.py b/custom_components/alfen_wallbox/alfen.py index 04f481b..5d0acb2 100644 --- a/custom_components/alfen_wallbox/alfen.py +++ b/custom_components/alfen_wallbox/alfen.py @@ -390,7 +390,7 @@ def __init__(self, response, prev_status): elif prop["id"] == "212D_0": self.main_active_lb_max_current = round(prop["value"], 2) elif prop["id"] == "2185_0": - self.enable_phase_switching = prop["value"] + self.enable_phase_switching = self.enable_phase_switching_as_str(prop["value"]) elif prop["id"] == "2053_0": self.charging_box_identifier = prop["value"] elif prop["id"] == "2057_0": @@ -474,6 +474,9 @@ def solar_charging_mode(self, code): switcher = {0: "Disable", 1: "Comfort", 2: "Green"} return switcher.get(code, "Unknown") + def enable_phase_switching_as_str(self, code): + switcher = {0: "Disabled", 1: "Enabled"} + return switcher.get(code, "Unknown") class AlfenDeviceInfo: def __init__(self, response): @@ -487,4 +490,4 @@ def __init__(self, response): self.model = f"{ALFEN_PRODUCT_MAP[self.model_id]} ({self.model_id})" self.object_id = response["ObjectId"] - self.type = response["Type"] \ No newline at end of file + self.type = response["Type"]