Skip to content

Commit

Permalink
Update alfen.py
Browse files Browse the repository at this point in the history
Convert 'change phase switching' value to string. Instead of 0 / 1 value it's now disabled / enabled.
  • Loading branch information
Emacee authored Jul 1, 2023
1 parent f29e1ac commit 3680350
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions custom_components/alfen_wallbox/alfen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down Expand Up @@ -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):
Expand All @@ -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"]
self.type = response["Type"]

0 comments on commit 3680350

Please sign in to comment.