From 59bff47792e1e308b04c274d408c5b19c5f9d89a Mon Sep 17 00:00:00 2001 From: manuel Date: Wed, 22 Oct 2025 14:36:08 +0200 Subject: add power plugs --- esphome/config/powerplug_awp07l.yaml | 128 +++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 esphome/config/powerplug_awp07l.yaml (limited to 'esphome/config/powerplug_awp07l.yaml') diff --git a/esphome/config/powerplug_awp07l.yaml b/esphome/config/powerplug_awp07l.yaml new file mode 100644 index 0000000..08a9e62 --- /dev/null +++ b/esphome/config/powerplug_awp07l.yaml @@ -0,0 +1,128 @@ +substitutions: + device_name: powerplug-awp07l + friendly_name: "Power Plug AWP07L" + #current_resistor: 0.001 + #voltage_divider: 1886 + current_resistor: 0.000995585395670478 + voltage_divider: 1913.830752419618 + current_multiply: 0.8667070272988949 + # max power is 3450W for 15A and 2300W for 10A + max_power: "2300" + +esphome: + name: ${device_name} + friendly_name: ${friendly_name} + +esp8266: + board: esp01_1m + +# Enable logging +logger: + # make RXD / TXD available + baud_rate: 0 + +# Enable Home Assistant API +api: + encryption: + key: !secret api_encryption_key + +# OTA +ota: + - platform: esphome + password: !secret ota_password + +# WiFi Credentials +wifi: + domain: .lan + ssid: !secret wifi_ssid + password: !secret wifi_password + # see https://github.com/esphome/issues/issues/1532 + power_save_mode: HIGH + + # Enable fallback hotspot (captive portal) in case wifi connection fails + ap: + ssid: "${device_name} Hotspot" + password: !secret wifi_ap_password + +captive_portal: + +binary_sensor: + - platform: gpio + name: "Button" + device_class: power + pin: + number: GPIO13 + inverted: true + on_press: + - switch.toggle: relay + internal: true + +sensor: + - platform: hlw8012 + model: BL0937 + sel_pin: + number: GPIO12 + inverted: true + cf_pin: GPIO05 + cf1_pin: GPIO14 + current_resistor: ${current_resistor} + voltage_divider: ${voltage_divider} + current: + name: "Current" + unit_of_measurement: "A" + accuracy_decimals: 3 + icon: "mdi:flash-outline" + filters: + - multiply: ${current_multiply} + - throttle_with_priority: + timeout: 10s + value: + - nan + - 0 + voltage: + name: "Voltage" + unit_of_measurement: "V" + icon: "mdi:flash-outline" + filters: + - throttle_with_priority: + timeout: 10s + value: + - nan + - 0 + power: + name: "Power" + unit_of_measurement: "W" + icon: "mdi:flash-outline" + filters: + - throttle_with_priority: + timeout: 10s + value: + - nan + - 0 + on_value_range: + - above: ${max_power} + then: + - switch.turn_off: relay + - output.turn_off: led + energy: + name: "Energy" + unit_of_measurement: "Wh" + icon: "mdi:flash-outline" + update_interval: 1s + change_mode_every: 4 + +switch: + - platform: gpio + name: "Relay" + pin: GPIO15 + id: relay + on_turn_on: + - output.turn_on: led + on_turn_off: + - output.turn_off: led + +output: + - platform: esp8266_pwm + id: led + pin: GPIO00 + inverted: true -- cgit v1.2.3