From 079e6e060dbc50b60ef3889534387b3074c2a7b2 Mon Sep 17 00:00:00 2001 From: metalblue Date: Mon, 8 May 2023 09:32:05 +0100 Subject: [PATCH] Add datetime sensor class for Invertor Time sensor --- GivTCP/GivLUT.py | 2 +- GivTCP/HA_Discovery.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/GivTCP/GivLUT.py b/GivTCP/GivLUT.py index 267e845a..6ef092a1 100644 --- a/GivTCP/GivLUT.py +++ b/GivTCP/GivLUT.py @@ -148,7 +148,7 @@ class GivLUT: "Battery_Type":GEType("sensor","string","","","",False,False,False), "Battery_Capacity_kWh":GEType("sensor","","",0,maxBatPower,True,True,False), "Invertor_Serial_Number":GEType("sensor","string","","","",False,False,False), - "Invertor_Time":GEType("sensor","","","","",False,False,False), + "Invertor_Time":GEType("sensor","datetime","","","",False,False,False), "Invertor_Max_Rate":GEType("sensor","","",0,maxBatPower,True,False,False), "Active_Power_Rate":GEType("number","","setActivePowerRate",0,100,True,False,False), "Invertor_Firmware":GEType("sensor","string","",0,10000,False,False,False), diff --git a/GivTCP/HA_Discovery.py b/GivTCP/HA_Discovery.py index 68744791..14c447e6 100644 --- a/GivTCP/HA_Discovery.py +++ b/GivTCP/HA_Discovery.py @@ -155,6 +155,8 @@ def create_device_payload(topic,SN): if GivLUT.entity_type[str(topic).split("/")[-1]].sensorClass=="timestamp": del(tempObj['unit_of_meas']) tempObj['device_class']="timestamp" + if GivLUT.entity_type[str(topic).split("/")[-1]].sensorClass=="datetime": + del(tempObj['unit_of_meas']) if GivLUT.entity_type[str(topic).split("/")[-1]].sensorClass=="string": del(tempObj['unit_of_meas']) tempObj['device_class']="enum"