Toevoegen electriciteitproductie

This commit is contained in:
Ard Kuijpers
2020-06-03 23:41:58 +02:00
parent 957e8c8383
commit df81a554dc
2 changed files with 15 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
from pydantic import BaseSettings, Field
import homie
VERSION = "0.1.0"
VERSION = "0.1.1"
class Settings(BaseSettings):

View File

@@ -32,9 +32,13 @@ class Node_ElectricityMeter(Node_Base):
self.add_property(Property_Enum(self, "tariff", "Tariff", data_format="tariff1,tariff2", settable=False))
self._tariffs = {1: "tariff1", 2: "tariff2" }
self.add_property(Property_Energy(self, "delivery-tariff1", "Delivery tariff 1"))
self.add_property(Property_Energy(self, "delivery-tariff2", "Delivery tariff 2"))
self.add_property(Property_Power(self, "power", "Power"))
self.add_property(Property_Energy(self, "usage-tariff1", "Usage tariff 1"))
self.add_property(Property_Energy(self, "usage-tariff2", "Usage tariff 2"))
self.add_property(Property_Power(self, "actual-usage", "Actual usage"))
self.add_property(Property_Energy(self, "production-tariff1", "Production tariff 1"))
self.add_property(Property_Energy(self, "production-tariff2", "Production tariff 2"))
self.add_property(Property_Power(self, "actual-production", "Actual production"))
self.add_property(Property_Voltage(self, "voltage-l1", "Voltage L1"))
self.add_property(Property_Voltage(self, "voltage-l2", "Voltage L2"))
@@ -52,9 +56,13 @@ class Node_ElectricityMeter(Node_Base):
logger.debug("Updating electricity meter properties")
self.get_property("tariff-indicator").value = int(telegram.ELECTRICITY_ACTIVE_TARIFF.value)
self.get_property("tariff").value = self._tariffs[int(telegram.ELECTRICITY_ACTIVE_TARIFF.value)]
self.get_property("delivery-tariff1").value = float(telegram.ELECTRICITY_USED_TARIFF_1.value)
self.get_property("delivery-tariff2").value = float(telegram.ELECTRICITY_USED_TARIFF_2.value)
self.get_property("power").value = float(telegram.CURRENT_ELECTRICITY_USAGE.value)
self.get_property("usage-tariff1").value = float(telegram.ELECTRICITY_USED_TARIFF_1.value)
self.get_property("usage-tariff2").value = float(telegram.ELECTRICITY_USED_TARIFF_2.value)
self.get_property("actual-usage").value = float(telegram.CURRENT_ELECTRICITY_USAGE.value)
self.get_property("production-tariff1").value = float(telegram.ELECTRICITY_DELIVERED_TARIFF_1.value)
self.get_property("production-tariff2").value = float(telegram.ELECTRICITY_DELIVERED_TARIFF_2.value)
self.get_property("actual-production").value = float(telegram.CURRENT_ELECTRICITY_DELIVERY.value)
self.get_property("voltage-l1").value = float(telegram.INSTANTANEOUS_VOLTAGE_L1.value)
self.get_property("current-l1").value = float(telegram.INSTANTANEOUS_CURRENT_L1.value)