From de2427bb75ae5fcd281584e1510f35118c7babe6 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 28 Sep 2024 11:36:46 +0100 Subject: [PATCH] Compute COP --- faikin.yaml | 51 ++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 9 deletions(-) diff --git a/faikin.yaml b/faikin.yaml index b98257b..17203b7 100644 --- a/faikin.yaml +++ b/faikin.yaml @@ -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 -- 2.49.0