From: David Woodhouse Date: Thu, 15 Aug 2024 05:10:45 +0000 (+0100) Subject: Add Tongou power meters X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=514c81a607be324c5952fe636b7b86397ad782de;p=users%2Fdwmw2%2Fesp32-pool.git Add Tongou power meters --- diff --git a/heat-pump-1.yaml b/heat-pump-1.yaml new file mode 100644 index 0000000..49fd7ca --- /dev/null +++ b/heat-pump-1.yaml @@ -0,0 +1,10 @@ +substitutions: + name: "heat-pump-1" + tongou_name: "Heat pump feed 1" + voltage_ref: "15928" + current_ref: "126130" + power_ref: "313.6" + energy_ref: "2691" + +packages: + tongou: !include tongou.yaml diff --git a/heat-pump-2.yaml b/heat-pump-2.yaml new file mode 100644 index 0000000..d1f8d67 --- /dev/null +++ b/heat-pump-2.yaml @@ -0,0 +1,10 @@ +substitutions: + name: "heat-pump-2" + tongou_name: "Heat pump feed 2" + voltage_ref: "15929" + current_ref: "125910" + power_ref: "313.0" + energy_ref: "2686" + +packages: + tongou: !include tongou.yaml diff --git a/power-light-spare2.yaml b/power-light-spare2.yaml new file mode 100644 index 0000000..317fb50 --- /dev/null +++ b/power-light-spare2.yaml @@ -0,0 +1,10 @@ +substitutions: + name: "power-light-spare2" + tongou_name: "10A spare 2" + voltage_ref: "15968" + current_ref: "124180" + power_ref: "309.1" + energy_ref: "2653" + +packages: + tongou: !include tongou.yaml diff --git a/power-light1.yaml b/power-light1.yaml new file mode 100644 index 0000000..3061b9d --- /dev/null +++ b/power-light1.yaml @@ -0,0 +1,10 @@ +substitutions: + name: "power-light1" + tongou_name: "Extension Light circuit" + voltage_ref: "15990" + current_ref: "124380" + power_ref: "309.8" + energy_ref: "2659" + +packages: + tongou: !include tongou.yaml diff --git a/power-light2.yaml b/power-light2.yaml new file mode 100644 index 0000000..048080b --- /dev/null +++ b/power-light2.yaml @@ -0,0 +1,10 @@ +substitutions: + name: "power-light2" + tongou_name: "Upstairs Light circuit" + voltage_ref: "" + current_ref: "0" + power_ref: "" + energy_ref: "" + +packages: + tongou: !include tongou.yaml diff --git a/power-light3.yaml b/power-light3.yaml new file mode 100644 index 0000000..764e2b5 --- /dev/null +++ b/power-light3.yaml @@ -0,0 +1,10 @@ +substitutions: + name: "power-light3" + tongou_name: "Downstairs Light circuit" + voltage_ref: "" + current_ref: "0" + power_ref: "" + energy_ref: "" + +packages: + tongou: !include tongou.yaml diff --git a/power-ring1.yaml b/power-ring1.yaml new file mode 100644 index 0000000..5b24606 --- /dev/null +++ b/power-ring1.yaml @@ -0,0 +1,10 @@ +substitutions: + name: "power-ring1" + tongou_name: "Shed circuit" + voltage_ref: "15925" + current_ref: "126230" + power_ref: "312.4" + energy_ref: "2681" + +packages: + tongou: !include tongou.yaml diff --git a/power-ring2.yaml b/power-ring2.yaml new file mode 100644 index 0000000..c3608c4 --- /dev/null +++ b/power-ring2.yaml @@ -0,0 +1,10 @@ +substitutions: + name: "power-ring2" + tongou_name: "Cooker circuit" + voltage_ref: "15935" + current_ref: "125730" + power_ref: "311.4" + energy_ref: "2672" + +packages: + tongou: !include tongou.yaml diff --git a/power-ring3.yaml b/power-ring3.yaml new file mode 100644 index 0000000..f60bf15 --- /dev/null +++ b/power-ring3.yaml @@ -0,0 +1,10 @@ +substitutions: + name: "power-ring3" + tongou_name: "Extension Ring" + voltage_ref: "15932" + current_ref: "127000" + power_ref: "314.3" + energy_ref: "2697" + +packages: + tongou: !include tongou.yaml diff --git a/power-ring4.yaml b/power-ring4.yaml new file mode 100644 index 0000000..17c2149 --- /dev/null +++ b/power-ring4.yaml @@ -0,0 +1,10 @@ +substitutions: + name: "power-ring4" + tongou_name: "House Ring" + voltage_ref: "15886" + current_ref: "128010" + power_ref: "315.9" + energy_ref: "2711" + +packages: + tongou: !include tongou.yaml diff --git a/power-sockets1.yaml b/power-sockets1.yaml new file mode 100644 index 0000000..e9ee13a --- /dev/null +++ b/power-sockets1.yaml @@ -0,0 +1,10 @@ +substitutions: + name: "power-sockets1" + tongou_name: "Immersion circuit" + voltage_ref: "15964" + current_ref: "127220" + power_ref: "317.0" + energy_ref: "2720" + +packages: + tongou: !include tongou.yaml diff --git a/tongou.yaml b/tongou.yaml new file mode 100644 index 0000000..085e64e --- /dev/null +++ b/tongou.yaml @@ -0,0 +1,126 @@ + + +esphome: + name: ${name} + +bk72xx: + board: generic-bk7231n-qfn32-tuya + +packages: + base: !include base.yaml # My wifi and MQTT settings. + +logger: + level: DEBUG + +mqtt: + on_connect: + then: + - light.turn_on: led + on_disconnect: + then: + - light.turn_off: led + +substitutions: + tongou_name: "10A circuit" + +text_sensor: + - platform: libretiny + version: + name: LibreTiny Version + +light: + - platform: status_led + internal: true + pin: + number: P15 + inverted: true + id: led + restore_mode: ALWAYS_OFF + +binary_sensor: + - platform: gpio + name: button + id: button + internal: true + pin: + number: P17 + inverted: true + filters: + - delayed_off: 10ms + on_press: + then: + switch.toggle: relay + +switch: + - platform: gpio + internal: true + pin: P24 + id: relay_on + restore_mode: ALWAYS_OFF + - platform: gpio + internal: true + pin: P26 + id: relay_off + restore_mode: ALWAYS_OFF + - platform: gpio + pin: + number: P9 + inverted: true + id: relay + name: Relay + # On by default should be fine as this is not a safety device + restore_mode: RESTORE_DEFAULT_ON + on_turn_on: + then: + - switch.turn_off: relay_off + - switch.turn_on: relay_on + - delay: 100ms + - switch.turn_off: relay_on + on_turn_off: + then: + - switch.turn_off: relay_on + - switch.turn_on: relay_off + - delay: 100ms + - switch.turn_off: relay_off + +uart: + id: uart_bus + tx_pin: TX1 + rx_pin: RX1 + baud_rate: 4800 + stop_bits: 1 + +sensor: + - platform: internal_temperature + name: "${tongou_name} Internal Temperature" + + - platform: bl0942 + uart_id: uart_bus + line_frequency: 50Hz + address: 0 + update_interval: 20s + current: + name: ${tongou_name} Current + voltage: + name: ${tongou_name} Voltage + power: + name: ${tongou_name} Power + filters: + multiply: -1 + energy: + name: ${tongou_name} Energy + frequency: + name: ${tongou_name} Frequency + accuracy_decimals: 2 + voltage_reference: ${voltage_ref} + current_reference: ${current_ref} + power_reference: ${power_ref} + energy_reference: ${energy_ref} + +# "pins": { +# "9": "LED_n;1", +# "15": "WifiLED_n;0", +# "17": "Btn;1", +# "24": "BridgeFWD;1", +# "26": "BridgeREV;1" +# },