From 475a3e1a88f693633c02afebd74dc423ac25977d Mon Sep 17 00:00:00 2001 From: ndrsnhs Date: Tue, 14 Apr 2026 14:24:15 +0200 Subject: [PATCH 1/4] add tasmota types --- .../modules/devices/tasmota/tasmota/bat.py | 33 +++++++++++-------- .../devices/tasmota/tasmota/counter.py | 14 ++++++++ .../devices/tasmota/tasmota/inverter.py | 29 +++++++++------- 3 files changed, 52 insertions(+), 24 deletions(-) diff --git a/packages/modules/devices/tasmota/tasmota/bat.py b/packages/modules/devices/tasmota/tasmota/bat.py index 72bd620c94..c40824ec5f 100644 --- a/packages/modules/devices/tasmota/tasmota/bat.py +++ b/packages/modules/devices/tasmota/tasmota/bat.py @@ -48,24 +48,31 @@ def update(self): imported = float(response['StatusSNS']['ENERGY']['Total']*1000) imported, _ = self.peak_filter.check_values(power, imported, None) _, exported = self.sim_counter.sim_count(power) - - bat_state = BatState( - power=power, - currents=currents, - imported=imported, - exported=exported - ) - else: + elif 'Itron' in response['StatusSNS']: power = float(response['StatusSNS']['Itron']['Power']) imported = float(response['StatusSNS']['Itron']['E_in']*1000) exported = float(response['StatusSNS']['Itron']['E_out']*1000) imported, exported = self.peak_filter.check_values(power, imported, exported) + elif 'MT681' in response['StatusSNS']: + power = float(response['StatusSNS']['MT681']['Watt_summe']) + imported = float(response['StatusSNS']['MT681']['Total_in']*1000) + exported = float(response['StatusSNS']['MT681']['Total_out']*1000) + imported, exported = self.peak_filter.check_values(power, imported, exported) + elif 'eBZ' in response['StatusSNS']: + power = float(response['StatusSNS']['eBZ']['Power']) + imported = float(response['StatusSNS']['eBZ']['E_in']*1000) + exported = float(response['StatusSNS']['eBZ']['E_out']*1000) + imported, exported = self.peak_filter.check_values(power, imported, exported) + else: + raise ValueError("Nicht unterstützter Tasmota Zählertyp. Bitte an den Support wenden.") - bat_state = BatState( - power=power, - imported=imported, - exported=exported - ) + bat_state = BatState( + power=power, + imported=imported, + exported=exported + ) + if 'currents' in locals(): + bat_state.currents = currents self.store.set(bat_state) diff --git a/packages/modules/devices/tasmota/tasmota/counter.py b/packages/modules/devices/tasmota/tasmota/counter.py index 3c4a940ef4..92618093bf 100644 --- a/packages/modules/devices/tasmota/tasmota/counter.py +++ b/packages/modules/devices/tasmota/tasmota/counter.py @@ -64,6 +64,20 @@ def update(self): imported = float(response['StatusSNS']['MT681']['Total_in']*1000) exported = float(response['StatusSNS']['MT681']['Total_out']*1000) imported, exported = self.peak_filter.check_values(power, imported, exported) + elif 'eBZ' in response['StatusSNS']: + powers = [0.0, 0.0, 0.0] + power = float(response['StatusSNS']['eBZ']['Power']) + imported = float(response['StatusSNS']['eBZ']['E_in']*1000) + exported = float(response['StatusSNS']['eBZ']['E_out']*1000) + imported, exported = self.peak_filter.check_values(power, imported, exported) + if ( + '36_7_0' in response['StatusSNS']['eBZ'] and + '56_7_0' in response['StatusSNS']['eBZ'] and + '76_7_0' in response['StatusSNS']['eBZ'] + ): + powers = [float(response['StatusSNS']['eBZ']['36_7_0']), + float(response['StatusSNS']['eBZ']['56_7_0']), + float(response['StatusSNS']['eBZ']['76_7_0'])] else: raise ValueError("Nicht unterstützter Tasmota Zählertyp. Bitte an den Support wenden.") diff --git a/packages/modules/devices/tasmota/tasmota/inverter.py b/packages/modules/devices/tasmota/tasmota/inverter.py index 0ab3e2ad8f..117900b7cd 100644 --- a/packages/modules/devices/tasmota/tasmota/inverter.py +++ b/packages/modules/devices/tasmota/tasmota/inverter.py @@ -47,20 +47,27 @@ def update(self): currents[self.__phase-1] = (response['StatusSNS']['ENERGY']['Current']), 0.0, 0.0 self.peak_filter.check_values(power) _, exported = self.sim_counter.sim_count(power) - - inverter_state = InverterState( - power=power, - currents=currents, - exported=exported - ) - else: + elif 'Itron' in response['StatusSNS']: power = float(response['StatusSNS']['Itron']['Power']) * -1 exported = float(response['StatusSNS']['Itron']['E_out']*1000) _, exported = self.peak_filter.check_values(power, None, exported) - inverter_state = InverterState( - power=power, - exported=exported - ) + elif 'MT681' in response['StatusSNS']: + power = float(response['StatusSNS']['MT681']['Watt_summe']) + exported = float(response['StatusSNS']['MT681']['Total_out']*1000) + _, exported = self.peak_filter.check_values(power, None, exported) + elif 'eBZ' in response['StatusSNS']: + power = float(response['StatusSNS']['eBZ']['Power']) + exported = float(response['StatusSNS']['eBZ']['E_out']*1000) + _, exported = self.peak_filter.check_values(power, None, exported) + else: + raise ValueError("Nicht unterstützter Tasmota Zählertyp. Bitte an den Support wenden.") + + inverter_state = InverterState( + power=power, + exported=exported + ) + if 'currents' in locals(): + inverter_state.currents = currents self.store.set(inverter_state) From d22d48cedecef2f16250f365785134ea4c83c121 Mon Sep 17 00:00:00 2001 From: ndrsnhs Date: Wed, 20 May 2026 09:08:45 +0200 Subject: [PATCH 2/4] set values directly --- .../modules/devices/tasmota/tasmota/bat.py | 6 +++--- .../modules/devices/tasmota/tasmota/counter.py | 18 +++++++++--------- .../devices/tasmota/tasmota/inverter.py | 12 +++++------- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/packages/modules/devices/tasmota/tasmota/bat.py b/packages/modules/devices/tasmota/tasmota/bat.py index c40824ec5f..27906648e9 100644 --- a/packages/modules/devices/tasmota/tasmota/bat.py +++ b/packages/modules/devices/tasmota/tasmota/bat.py @@ -40,6 +40,7 @@ def update(self): url = "http://" + self.__ip_address + "/cm?cmnd=Status%208" response = req.get_http_session().get(url, timeout=5).json() + currents = None if 'ENERGY' in response['StatusSNS']: currents = [0.0, 0.0, 0.0] @@ -69,10 +70,9 @@ def update(self): bat_state = BatState( power=power, imported=imported, - exported=exported + exported=exported, + currents=currents ) - if 'currents' in locals(): - bat_state.currents = currents self.store.set(bat_state) diff --git a/packages/modules/devices/tasmota/tasmota/counter.py b/packages/modules/devices/tasmota/tasmota/counter.py index 92618093bf..76c9713bf1 100644 --- a/packages/modules/devices/tasmota/tasmota/counter.py +++ b/packages/modules/devices/tasmota/tasmota/counter.py @@ -40,6 +40,10 @@ def update(self): url = "http://" + self.__ip_address + "/cm?cmnd=Status%208" response = req.get_http_session().get(url, timeout=5).json() + voltages = None + currents = None + powers = None + power_factors = None if 'ENERGY' in response['StatusSNS']: voltages = [0.0, 0.0, 0.0] powers = [0.0, 0.0, 0.0] @@ -84,16 +88,12 @@ def update(self): counter_state = CounterState( power=power, imported=imported, - exported=exported + exported=exported, + voltages=voltages, + currents=currents, + powers=powers, + power_factors=power_factors ) - if 'voltages' in locals(): - counter_state.voltages = voltages - if 'currents' in locals(): - counter_state.currents = currents - if 'powers' in locals(): - counter_state.powers = powers - if 'power_factors' in locals(): - counter_state.power_factors = power_factors self.store.set(counter_state) diff --git a/packages/modules/devices/tasmota/tasmota/inverter.py b/packages/modules/devices/tasmota/tasmota/inverter.py index 117900b7cd..502f66b534 100644 --- a/packages/modules/devices/tasmota/tasmota/inverter.py +++ b/packages/modules/devices/tasmota/tasmota/inverter.py @@ -40,9 +40,8 @@ def update(self): url = "http://" + self.__ip_address + "/cm?cmnd=Status%208" response = req.get_http_session().get(url, timeout=5).json() + currents = None if 'ENERGY' in response['StatusSNS']: - currents = [0.0, 0.0, 0.0] - power = float(response['StatusSNS']['ENERGY']['Power']) * -1 currents[self.__phase-1] = (response['StatusSNS']['ENERGY']['Current']), 0.0, 0.0 self.peak_filter.check_values(power) @@ -52,11 +51,11 @@ def update(self): exported = float(response['StatusSNS']['Itron']['E_out']*1000) _, exported = self.peak_filter.check_values(power, None, exported) elif 'MT681' in response['StatusSNS']: - power = float(response['StatusSNS']['MT681']['Watt_summe']) + power = float(response['StatusSNS']['MT681']['Watt_summe']) * -1 exported = float(response['StatusSNS']['MT681']['Total_out']*1000) _, exported = self.peak_filter.check_values(power, None, exported) elif 'eBZ' in response['StatusSNS']: - power = float(response['StatusSNS']['eBZ']['Power']) + power = float(response['StatusSNS']['eBZ']['Power']) * -1 exported = float(response['StatusSNS']['eBZ']['E_out']*1000) _, exported = self.peak_filter.check_values(power, None, exported) else: @@ -64,10 +63,9 @@ def update(self): inverter_state = InverterState( power=power, - exported=exported + exported=exported, + currents=currents ) - if 'currents' in locals(): - inverter_state.currents = currents self.store.set(inverter_state) From c4715cdc8cc96dad44bf8be2f440a9f72e7a14b8 Mon Sep 17 00:00:00 2001 From: ndrsnhs Date: Wed, 20 May 2026 09:21:26 +0200 Subject: [PATCH 3/4] initialize currents --- packages/modules/devices/tasmota/tasmota/inverter.py | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/modules/devices/tasmota/tasmota/inverter.py b/packages/modules/devices/tasmota/tasmota/inverter.py index 502f66b534..52f77a01da 100644 --- a/packages/modules/devices/tasmota/tasmota/inverter.py +++ b/packages/modules/devices/tasmota/tasmota/inverter.py @@ -42,6 +42,7 @@ def update(self): currents = None if 'ENERGY' in response['StatusSNS']: + currents = [0.0, 0.0, 0.0] power = float(response['StatusSNS']['ENERGY']['Power']) * -1 currents[self.__phase-1] = (response['StatusSNS']['ENERGY']['Current']), 0.0, 0.0 self.peak_filter.check_values(power) From 3f2e896ff6a6ffb4b18950c5d531f8630e74e42f Mon Sep 17 00:00:00 2001 From: ndrsnhs Date: Wed, 20 May 2026 09:32:45 +0200 Subject: [PATCH 4/4] fix --- packages/modules/devices/tasmota/tasmota/bat.py | 2 +- packages/modules/devices/tasmota/tasmota/inverter.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/modules/devices/tasmota/tasmota/bat.py b/packages/modules/devices/tasmota/tasmota/bat.py index 27906648e9..71d1971a13 100644 --- a/packages/modules/devices/tasmota/tasmota/bat.py +++ b/packages/modules/devices/tasmota/tasmota/bat.py @@ -45,7 +45,7 @@ def update(self): currents = [0.0, 0.0, 0.0] power = float(response['StatusSNS']['ENERGY']['Power']) - currents[self.__phase-1] = (response['StatusSNS']['ENERGY']['Current']), 0.0, 0.0 + currents[self.__phase-1] = float(response['StatusSNS']['ENERGY']['Current']) imported = float(response['StatusSNS']['ENERGY']['Total']*1000) imported, _ = self.peak_filter.check_values(power, imported, None) _, exported = self.sim_counter.sim_count(power) diff --git a/packages/modules/devices/tasmota/tasmota/inverter.py b/packages/modules/devices/tasmota/tasmota/inverter.py index 52f77a01da..e9cfec178c 100644 --- a/packages/modules/devices/tasmota/tasmota/inverter.py +++ b/packages/modules/devices/tasmota/tasmota/inverter.py @@ -44,7 +44,7 @@ def update(self): if 'ENERGY' in response['StatusSNS']: currents = [0.0, 0.0, 0.0] power = float(response['StatusSNS']['ENERGY']['Power']) * -1 - currents[self.__phase-1] = (response['StatusSNS']['ENERGY']['Current']), 0.0, 0.0 + currents[self.__phase-1] = float(response['StatusSNS']['ENERGY']['Current']) self.peak_filter.check_values(power) _, exported = self.sim_counter.sim_count(power) elif 'Itron' in response['StatusSNS']: