diff --git a/pymyenergi/cli.py b/pymyenergi/cli.py index d092d1f..1f78933 100644 --- a/pymyenergi/cli.py +++ b/pymyenergi/cli.py @@ -48,10 +48,16 @@ async def main(args): out = out + f"Energy diverted : {client.energy_diverted/1000:.2f}kWh\n" out = out + "Devices:\n" for device in devices: - out = out + f" {device.kind.capitalize()}: {device.name}" + out = out + f"\t{device.kind.capitalize()}: {device.name}" if device.kind != HARVI: - out = out + f"\t{device.energy_total}Wh today" - out = out + "\n" + out = out + f"\t{device.energy_total}Wh today\n" + for key in device.ct_keys: + out = ( + out + f"\t{key} {device.history_data.get(key, 0)}Wh today\n" + ) + out = out + "\n" + else: + out = out + "\n" print(out) elif args.command in ["zappi", "eddi", "harvi"]: device = device_factory(conn, args.command, args.serial) diff --git a/pymyenergi/eddi.py b/pymyenergi/eddi.py index 86cbf59..e2a86bd 100644 --- a/pymyenergi/eddi.py +++ b/pymyenergi/eddi.py @@ -22,6 +22,17 @@ def kind(self): def prefix(self): return "E" + @property + def ct_keys(self): + """Return CT key names that are not none""" + keys = {} + for i in range(2): + ct = getattr(self, f"ct{i+1}") + if ct.name_as_key == "ct_none": + continue + keys[ct.name_as_key] = keys.get(ct.name_as_key, 0) + 1 + return keys + @property def l1_phase(self): """What phase L1 is connected to""" @@ -72,4 +83,6 @@ def show(self): ret = ret + f"S/N {self.serial_number} version {self.firmware_version}\n\n" ret = ret + f"CT 1 {self.ct1.name} {self.ct1.power}W\n" ret = ret + f"CT 2 {self.ct2.name} {self.ct2.power}W\n" + for key in self.ct_keys: + ret = ret + f"Energy {key} {self.history_data.get(key, 0)}Wh\n" return ret diff --git a/pymyenergi/harvi.py b/pymyenergi/harvi.py index ad4c35d..15a5e01 100644 --- a/pymyenergi/harvi.py +++ b/pymyenergi/harvi.py @@ -14,6 +14,17 @@ def __init__(self, connection: Connection, serialno, data={}) -> None: def kind(self): return HARVI + @property + def ct_keys(self): + """Return CT key names that are not none""" + keys = {} + for i in range(3): + ct = getattr(self, f"ct{i+1}") + if ct.name_as_key == "ct_none": + continue + keys[ct.name_as_key] = keys.get(ct.name_as_key, 0) + 1 + return keys + @property def ct3(self): """Current transformer 3""" diff --git a/pymyenergi/zappi.py b/pymyenergi/zappi.py index fe0c132..fb5a835 100644 --- a/pymyenergi/zappi.py +++ b/pymyenergi/zappi.py @@ -30,6 +30,17 @@ def kind(self): def prefix(self): return "Z" + @property + def ct_keys(self): + """Return CT key names that are not none""" + keys = {} + for i in range(6): + ct = getattr(self, f"ct{i+1}") + if ct.name_as_key == "ct_none": + continue + keys[ct.name_as_key] = keys.get(ct.name_as_key, 0) + 1 + return keys + @property def charge_mode(self): """Charge mode, one of Fast, Eco, Eco+ and Stopped""" @@ -212,6 +223,9 @@ def show(self): ret = ret + f" Grid : {self.power_grid}W\n" ret = ret + f" Generated : {self.power_generated}W\n" ret = ret + "\n" + for key in self.ct_keys: + ret = ret + f"Energy {key} {self.history_data.get(key, 0)}Wh\n" + ret = ret + "\n" ret = ret + f"Boost with {self.boost_amount}kWh\n" ret = ret + "Smart Boost start at" ret = ret + f" {self.smart_boost_start_hour}:{self.smart_boost_start_minute}"