From a83a3af5b11fdf0f7a9d803dfe62aa2a9bf4ec5f Mon Sep 17 00:00:00 2001 From: Chris Straffon Date: Mon, 10 Jul 2023 10:32:26 +0100 Subject: [PATCH] #7 - Added missing powerfactor for meter systems, changed powerfactor to show between -1 and +1 --- custom_components/grott/sensors/sensors_mqtt.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/custom_components/grott/sensors/sensors_mqtt.py b/custom_components/grott/sensors/sensors_mqtt.py index bbf15f2..52a3de3 100644 --- a/custom_components/grott/sensors/sensors_mqtt.py +++ b/custom_components/grott/sensors/sensors_mqtt.py @@ -1100,7 +1100,7 @@ def datetime_formatter(mqtt_data): "state_class": None, "icon": "mdi:information-outline", "func": lambda js: js['values']["powerfactor_l1"], - "divider": 10, + "divider": 1000, "unique_name": "mqtt_100", }, { @@ -1110,7 +1110,7 @@ def datetime_formatter(mqtt_data): "state_class": None, "icon": "mdi:information-outline", "func": lambda js: js['values']["powerfactor_l2"], - "divider": 10, + "divider": 1000, "unique_name": "mqtt_101", }, { @@ -1120,9 +1120,19 @@ def datetime_formatter(mqtt_data): "state_class": None, "icon": "mdi:information-outline", "func": lambda js: js['values']["powerfactor_l3"], - "divider": 10, + "divider": 1000, "unique_name": "mqtt_102", }, + { + "name": "Power factor", + "device_class": None, + "unit_of_measurement": None, + "state_class": None, + "icon": "mdi:information-outline", + "func": lambda js: js['values']["powerfactor"], + "divider": 1000, + "unique_name": "mqtt_103", + }, #The following entries are out-of-order in the above list, be sure to check for the latest value for unique_name from both lists #mqtt_066 - PV3 Voltage