diff --git a/fronius-smartmeter.py b/fronius-smartmeter.py index 4bbfe20..966fb4d 100644 --- a/fronius-smartmeter.py +++ b/fronius-smartmeter.py @@ -257,19 +257,30 @@ def _update(self): self._dbusservice["/Ac/L2/Energy/Reverse"] = None self._dbusservice["/Ac/L3/Energy/Forward"] = None self._dbusservice["/Ac/L3/Energy/Reverse"] = None - self._dbusservice["/Ac/Frequency"] = meter_data["Frequency_Phase_Average"] - self._dbusservice["/Ac/L1/Voltage"] = meter_data["Voltage_AC_Phase_1"] - self._dbusservice["/Ac/L2/Voltage"] = meter_data["Voltage_AC_Phase_2"] - self._dbusservice["/Ac/L3/Voltage"] = meter_data["Voltage_AC_Phase_3"] - self._dbusservice["/Ac/Current"] = meter_data["Current_AC_Sum"] - self._dbusservice["/Ac/L1/Current"] = meter_data["Current_AC_Phase_1"] - self._dbusservice["/Ac/L2/Current"] = meter_data["Current_AC_Phase_2"] - self._dbusservice["/Ac/L3/Current"] = meter_data["Current_AC_Phase_3"] + if "Frequency_Phase_Average" in meter_data: + self._dbusservice["/Ac/Frequency"] = meter_data["Frequency_Phase_Average"] + if "Voltage_AC_Phase_1" in meter_data: + self._dbusservice["/Ac/L1/Voltage"] = meter_data["Voltage_AC_Phase_1"] + if "Voltage_AC_Phase_2" in meter_data: + self._dbusservice["/Ac/L2/Voltage"] = meter_data["Voltage_AC_Phase_2"] + if "Voltage_AC_Phase_3" in meter_data: + self._dbusservice["/Ac/L3/Voltage"] = meter_data["Voltage_AC_Phase_3"] + if "Current_AC_Sum" in meter_data: + self._dbusservice["/Ac/Current"] = meter_data["Current_AC_Sum"] + if "Current_AC_Phase_1" in meter_data: + self._dbusservice["/Ac/L1/Current"] = meter_data["Current_AC_Phase_1"] + if "Current_AC_Phase_2" in meter_data: + self._dbusservice["/Ac/L2/Current"] = meter_data["Current_AC_Phase_2"] + if "Current_AC_Phase_3" in meter_data: + self._dbusservice["/Ac/L3/Current"] = meter_data["Current_AC_Phase_3"] # positive: consumption, negative: feed into grid self._dbusservice["/Ac/Power"] = meter_consumption - self._dbusservice["/Ac/L1/Power"] = meter_data["PowerReal_P_Phase_1"] - self._dbusservice["/Ac/L2/Power"] = meter_data["PowerReal_P_Phase_2"] - self._dbusservice["/Ac/L3/Power"] = meter_data["PowerReal_P_Phase_3"] + if "PowerReal_P_Phase_1" in meter_data: + self._dbusservice["/Ac/L1/Power"] = meter_data["PowerReal_P_Phase_1"] + if "PowerReal_P_Phase_2" in meter_data: + self._dbusservice["/Ac/L2/Power"] = meter_data["PowerReal_P_Phase_2"] + if "PowerReal_P_Phase_3" in meter_data: + self._dbusservice["/Ac/L3/Power"] = meter_data["PowerReal_P_Phase_3"] self._dbusservice["/Ac/Energy/Forward"] = ( float(meter_data["EnergyReal_WAC_Sum_Consumed"]) / 1000.0 ) diff --git a/version b/version index 1206807..d4a29ee 100644 --- a/version +++ b/version @@ -1 +1 @@ -v1.9 \ No newline at end of file +v1.10 \ No newline at end of file