From 965cd7de94f739027e8cfa6a148c00441bce6f44 Mon Sep 17 00:00:00 2001 From: Martin Saunders Date: Sun, 20 Nov 2022 15:14:24 +0000 Subject: [PATCH 1/2] Add systemIO_power and update MQTT syntax Added the new systemIO_power register and also updated the MQTT syntax as the old one stops working in the 2022.12 HA release. --- Home Assistant example/configuration.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Home Assistant example/configuration.yaml b/Home Assistant example/configuration.yaml index 2ccc2b1..0cdb727 100644 --- a/Home Assistant example/configuration.yaml +++ b/Home Assistant example/configuration.yaml @@ -1,4 +1,5 @@ #Sofar ME3000SP Sofar2mqtt sensors +#Updated to now include the new MQTT sensors required for 2022.12 release of Home Assistant onwards sensor: - platform: integration name: Energy_from_battery @@ -83,6 +84,18 @@ mqtt: {% else %} {{ (value_json.battery_power) * 10 }} {% endif %} + + - name: "inverter_system_power" + state_topic: "Sofar2mqtt/state" + unit_of_measurement: "W" + device_class: power + state_class: measurement + value_template: > + {% if value_json.systemIO_power > (65535 / 2) %} + {{ -(65535 - value_json.systemIO_power) * 10 }} + {% else %} + {{ (value_json.systemIO_power) * 10 }} + {% endif %} - name: "inverter_battery_discharge" state_topic: "Sofar2mqtt/state" From 456cf82afec87a9372c10990a6575f6618fe98be Mon Sep 17 00:00:00 2001 From: Martin Saunders Date: Mon, 21 Nov 2022 08:58:30 +0000 Subject: [PATCH 2/2] Update configuration.yaml Switching the direction of in/out for systemIO_power to match battery_power --- Home Assistant example/configuration.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Home Assistant example/configuration.yaml b/Home Assistant example/configuration.yaml index 0cdb727..1d2a900 100644 --- a/Home Assistant example/configuration.yaml +++ b/Home Assistant example/configuration.yaml @@ -92,9 +92,9 @@ mqtt: state_class: measurement value_template: > {% if value_json.systemIO_power > (65535 / 2) %} - {{ -(65535 - value_json.systemIO_power) * 10 }} + {{ (65535 - value_json.systemIO_power) * 10 }} {% else %} - {{ (value_json.systemIO_power) * 10 }} + {{ -(value_json.systemIO_power) * 10 }} {% endif %} - name: "inverter_battery_discharge"