From 8d2da9de275a4b234eb78b66216fe8403a8edf0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20St=C3=A4ubert?= Date: Thu, 7 Mar 2024 11:53:29 +0100 Subject: [PATCH] Update x3_hybrid_g4.py refactor battery_modes to _decode_battery_mode --- solax/inverters/x3_hybrid_g4.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/solax/inverters/x3_hybrid_g4.py b/solax/inverters/x3_hybrid_g4.py index b5a43c9..10d5a96 100644 --- a/solax/inverters/x3_hybrid_g4.py +++ b/solax/inverters/x3_hybrid_g4.py @@ -56,13 +56,13 @@ def _decode_run_mode(cls, run_mode): }.get(run_mode) @classmethod - def battery_modes(value): + def _decode_battery_mode(cls, battery_mode): return { 0: "Self Use Mode", 1: "Force Time Use", 2: "Back Up Mode", 3: "Feed-in Priority", - }.get(value, f"unmapped value '{value}'") + }.get(battery_mode) @classmethod def response_decoder(cls): @@ -124,7 +124,7 @@ def response_decoder(cls): "Battery Temperature": (105, Units.C, to_signed), "Battery Remaining Energy": (106, Units.KWH, div10), "Battery mode": (168, Units.NONE), - "Battery mode text": (168, Units.NONE, X3HybridG4.battery_mode), + "Battery mode text": (168, Units.NONE, X3HybridG4._decode_battery_mode), "Battery Voltage": (pack_u16(169, 170), Units.V, div100), }