]> www.infradead.org Git - users/dwmw2/esp32-pool.git/commitdiff
Compute COP
authorDavid Woodhouse <dwmw@amazon.co.uk>
Sat, 28 Sep 2024 10:36:46 +0000 (11:36 +0100)
committerDavid Woodhouse <dwmw@amazon.co.uk>
Sat, 28 Sep 2024 10:36:46 +0000 (11:36 +0100)
faikin.yaml

index b98257bcd298b1a98deb7326d41320ed45de911a..17203b71350c5f4ab93d3f0312b7ef5f662a22f5 100644 (file)
@@ -10,7 +10,8 @@
 # Then you can program it. It'll fail to reset, just release IO0 and power cycle.
 
 substitutions:
-  name: faikin3
+  name: faikin4
+  pump: "2"
 # heatpump heating/cooling switch
 # available modes: HEAT_ROOM_TEMP, HEAT_FLOW_TEMP, HEAT_COMPENSATION_CURVE, COOL_ROOM_TEMP, COOL_FLOW_TEMP
   default_heating_switch_mode: HEAT_COMPENSATION_CURVE
@@ -92,16 +93,8 @@ packages:
     refresh: always
     files: [
             confs/base.yaml,
-            #confs/esp32s3.yaml, # confs/esp32.yaml, for regular board
             confs/zone1.yaml,
-            ## enable if you want to use zone 2
-            #confs/zone2.yaml,
-            ## enable label language file
             confs/ecodan-labels-en.yaml,
-            #confs/ecodan-labels-nl.yaml,
-            #confs/ecodan-labels-it.yaml,
-            #confs/server-control.yaml,
-            #confs/debug.yaml,
            ]
 
 light:
@@ -166,3 +159,43 @@ ecodan:
 #  update_interval: 30s
 #  rx_pin: GPIO34
 #  tx_pin: GPIO48
+
+sensor:
+  - platform: mqtt_subscribe
+    id: input_power
+    topic: power-ashp${pump}/sensor/heat_pump_${pump}_circuit_power/state
+    unit_of_measurement: W
+    on_value:
+      then:
+        lambda: |-
+          double p_in = x;
+          double p_out = id(computed_output_power).state;
+          if (p_in > 0 && p_out > 0)
+            id(cop).publish_state(p_out * 100000.0 / p_in);
+          else
+            id(cop).publish_state(NAN);
+  - platform: combination
+    type: linear
+    id: dup_output_power
+    sources:
+      - source: computed_output_power
+        coeffecient: 1
+    on_value:
+      then:
+        lambda: |-
+          double p_in = id(input_power).state;
+          double p_out = x;
+          if (p_in > 0 && p_out > 0)
+            id(cop).publish_state(p_out * 100000.0 / p_in);
+          else
+            id(cop).publish_state(NAN);
+
+  - platform: template
+    id: cop
+    name: "Computed COP"
+    unit_of_measurement: "%"
+    accuracy_decimals: 0
+    state_class: measurement
+    filters:
+      sliding_window_moving_average:
+        window_size: 2