86 lines
3.0 KiB
Python
86 lines
3.0 KiB
Python
from homie.node.node_base import Node_Base
|
|
|
|
from homie.node.property.property_enum import Property_Enum
|
|
from homie.node.property.property_integer import Property_Integer
|
|
from dsmr2mqtt.node.property.property_energy import Property_Energy
|
|
from dsmr2mqtt.node.property.property_power import Property_Power
|
|
from dsmr2mqtt.node.property.property_current import Property_Current
|
|
from dsmr2mqtt.node.property.property_voltage import Property_Voltage
|
|
|
|
|
|
class Node_ElectricityMeter(Node_Base):
|
|
def __init__(
|
|
self,
|
|
device,
|
|
id="electricitymeter",
|
|
name="Electricity meter",
|
|
type_="state",
|
|
retain=True,
|
|
qos=1,
|
|
state_values=None,
|
|
set_state=None,
|
|
):
|
|
assert state_values
|
|
assert set_state
|
|
|
|
super().__init__(device, id, name, type_, retain, qos)
|
|
|
|
|
|
self.add_property(Property_Integer(self, "tariff_indicator", "Tariff indicator", data_format="1:2", settable=False))
|
|
|
|
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_Voltage(self, "voltage_L1", "Voltage L1"))
|
|
self.add_property(Property_Voltage(self, "voltage_L2", "Voltage L2"))
|
|
self.add_property(Property_Voltage(self, "voltage_L3", "Voltage L3"))
|
|
|
|
self.add_property(Property_Current(self, "current_L1", "Current L1"))
|
|
self.add_property(Property_Current(self, "current_L2", "Current L2"))
|
|
self.add_property(Property_Current(self, "current_L3", "Current L3"))
|
|
|
|
self.add_property(Property_Power(self, "power_L1", "Power L1"))
|
|
self.add_property(Property_Power(self, "power_L2", "Power L2"))
|
|
self.add_property(Property_Power(self, "power_L3", "Power L3"))
|
|
|
|
def update_status(self, telegram: str):
|
|
|
|
#Telegram
|
|
# 1-3:0.2.8(50)
|
|
# 0-0:1.0.0(200603122725S)
|
|
# 0-0:96.1.1(4530303438303030303339393038333139)
|
|
# 1-0:1.8.1(001807.864*kWh)
|
|
# 1-0:1.8.2(001173.872*kWh)
|
|
# 1-0:2.8.1(000000.091*kWh)
|
|
# 1-0:2.8.2(000000.000*kWh)
|
|
# 0-0:96.14.0(0002)
|
|
# 1-0:1.7.0(00.909*kW)
|
|
# 1-0:2.7.0(00.000*kW)
|
|
# 0-0:96.7.21(00016)
|
|
# 0-0:96.7.9(00003)
|
|
# 1-0:99.97.0(0)(0-0:96.7.19)
|
|
# 1-0:32.32.0(00002)
|
|
# 1-0:52.32.0(00002)
|
|
# 1-0:72.32.0(00002)
|
|
# 1-0:32.36.0(00000)
|
|
# 1-0:52.36.0(00000)
|
|
# 1-0:72.36.0(00000)
|
|
# 0-0:96.13.0()
|
|
# 1-0:32.7.0(235.0*V)
|
|
# 1-0:52.7.0(237.0*V)
|
|
# 1-0:72.7.0(236.0*V)
|
|
# 1-0:31.7.0(001*A)
|
|
# 1-0:51.7.0(001*A)
|
|
# 1-0:71.7.0(001*A)
|
|
# 1-0:21.7.0(00.290*kW)
|
|
# 1-0:41.7.0(00.268*kW)
|
|
# 1-0:61.7.0(00.350*kW)
|
|
# 1-0:22.7.0(00.000*kW)
|
|
# 1-0:42.7.0(00.000*kW)
|
|
# 1-0:62.7.0(00.000*kW)
|
|
# 0-1:24.1.0(003)
|
|
# 0-1:96.1.0(4730303732303033393435373234323139)
|
|
# 0-1:24.2.1(200603122500S)(01741.782*m3)
|
|
pass
|