From: David Woodhouse Date: Mon, 14 Oct 2024 22:35:03 +0000 (+0100) Subject: Feed EmonCMS X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=db702a07d3edb37d207348cb232bef2f700d45ca;p=users%2Fdwmw2%2Fesp32-pool.git Feed EmonCMS --- diff --git a/heishamon.yaml b/heishamon.yaml index 09b77b7..86fd994 100644 --- a/heishamon.yaml +++ b/heishamon.yaml @@ -16,7 +16,6 @@ #HeishaMon/gpio.h: unsigned int gpioPin[NUMGPIO] = {33, 34, 35, 36, 37, 21, 47}; - substitutions: name: heishamon # heatpump heating/cooling switch @@ -48,9 +47,6 @@ esp32: # Custom sdkconfig options sdkconfig_options: COMPILER_OPTIMIZATION_SIZE: y - # Advanced tweaking options - advanced: - ignore_efuse_mac_crc: false external_components: - source: @@ -61,6 +57,7 @@ external_components: components: [ uart_mitm ] packages: base: !include base.yaml + emoncms: !include emoncms.yaml ecodan: url: file:/home/dwmw/git/esphome-ecodan-hp/ ref: main @@ -106,10 +103,15 @@ mqtt: switch (idx) { case 87: /* Boiler */ int svalue1 = x["svalue1"].as(); - ESP_LOGI("Evohome", "Boiler set to %d/%d", nvalue, svalue1); + float flow_temp = 30.0 + (svalue1 / 8.0); + ESP_LOGI("Evohome", "Boiler set to %d/%d, flow temp %f °C", nvalue, svalue1, flow_temp); id(tell_domo_svalue)->execute(908, std::to_string(svalue1/2)); + id(ecodan_instance).set_flow_target_temperature(flow_temp, esphome::ecodan::SetZone::ZONE_1); break; } + - topic: heishamon/log + then: + - script.execute: send_emoncms uart: @@ -225,7 +227,175 @@ sensor: - platform: internal_temperature name: ${internal_esp_temperature} entity_category: diagnostic + - platform: mqtt_subscribe + id: ashp1_feed_temp + topic: faikin3/sensor/feed_temp/state + on_value: + then: + - script.execute: + id: queue_emoncms + node: "ashp1" + input: "feed_temp" + value: !lambda "return x;" + - platform: mqtt_subscribe + id: ashp1_return_temp + topic: faikin3/sensor/return_temp/state + on_value: + then: + - script.execute: + id: queue_emoncms + node: "ashp1" + input: "return_temp" + value: !lambda "return x;" + - platform: mqtt_subscribe + id: ashp1_flow_rate + topic: faikin3/sensor/flow_rate/state + on_value: + then: + - script.execute: + id: queue_emoncms + node: "ashp1" + input: "flow_rate" + value: !lambda "return x;" + - platform: mqtt_subscribe + id: ashp1_outside_temp + topic: faikin3/sensor/outside_temp/state + on_value: + then: + - script.execute: + id: queue_emoncms + node: "ashp1" + input: "outside_temp" + value: !lambda "return x;" + - platform: mqtt_subscribe + id: ashp1_heat_output + topic: faikin3/sensor/estimated_output_power/state + on_value: + then: + - script.execute: + id: queue_emoncms + node: "ashp1" + input: "heat_output" + value: !lambda "return x;" + - platform: mqtt_subscribe + id: ashp1_elec_power + topic: power-ashp1/sensor/heat_pump_1_circuit_power/state + on_value: + then: + - script.execute: + id: queue_emoncms + node: "ashp1" + input: "elec_power" + value: !lambda "return x;" + - platform: mqtt_subscribe + id: ashp1_elec_usage + topic: power-ashp1/sensor/heat_pump_1_circuit_energy/state + on_value: + then: + - script.execute: + id: queue_emoncms + node: "ashp1" + input: "elec_usage" + value: !lambda "return x;" + - platform: mqtt_subscribe + id: ashp1_target_flow_temp + topic: faikin3/sensor/zone_1_h_c_setpoint_value/state + on_value: + then: + - script.execute: + id: queue_emoncms + node: "ashp1" + input: "target_flow_temp" + value: !lambda "return x;" + + - platform: mqtt_subscribe + id: ashp2_feed_temp + topic: faikin4/sensor/feed_temp/state + on_value: + then: + - script.execute: + id: queue_emoncms + node: "ashp2" + input: "feed_temp" + value: !lambda "return x;" + - platform: mqtt_subscribe + id: ashp2_return_temp + topic: faikin4/sensor/return_temp/state + on_value: + then: + - script.execute: + id: queue_emoncms + node: "ashp2" + input: "return_temp" + value: !lambda "return x;" + - platform: mqtt_subscribe + id: ashp2_flow_rate + topic: faikin4/sensor/flow_rate/state + on_value: + then: + - script.execute: + id: queue_emoncms + node: "ashp2" + input: "flow_rate" + value: !lambda "return x;" + - platform: mqtt_subscribe + id: ashp2_outside_temp + topic: faikin4/sensor/outside_temp/state + on_value: + then: + - script.execute: + id: queue_emoncms + node: "ashp2" + input: "outside_temp" + value: !lambda "return x;" + - platform: mqtt_subscribe + id: ashp2_heat_output + topic: faikin4/sensor/estimated_output_power/state + on_value: + then: + - script.execute: + id: queue_emoncms + node: "ashp2" + input: "heat_output" + value: !lambda "return x;" + - platform: mqtt_subscribe + id: ashp2_elec_power + on_value: + then: + - script.execute: + id: queue_emoncms + node: "ashp2" + input: "elec_power" + value: !lambda "return x;" + topic: power-ashp2/sensor/heat_pump_2_circuit_power/state + - platform: mqtt_subscribe + id: ashp2_elec_usage + topic: power-ashp2/sensor/heat_pump_2_circuit_energy/state + on_value: + then: + - script.execute: + id: queue_emoncms + node: "ashp2" + input: "elec_usage" + value: !lambda "return x;" + +text_sensor: + - platform: mqtt_subscribe + id: ashp1_operation_mode + topic: faikin3/sensor/operation_mode/state + on_value: + then: + - lambda: |- + bool dhw = (x == "Heating Water"); + bool ch = (x == "Space Heating"); + bool defrost = (x == "Frost Protection"); + ESP_LOGD("Emoncms", "Mode %s %d/%d/%d", x.c_str(), dhw, ch, defrost); + id(queue_emoncms).execute("ashp1", "dhw", dhw); + id(queue_emoncms).execute("ashp1", "ch", ch); + id(queue_emoncms).execute("ashp1", "frost", defrost); + + # is mutual exclusive with wifi # ethernet: # type: W5500