From 76b1dc4b3fe42ba041fddf26712e79c64b9aeab6 Mon Sep 17 00:00:00 2001 From: "Frank \"PHiAX\" Weggelaar" Date: Sun, 25 Jan 2026 14:30:24 +0100 Subject: [PATCH] Add shelly to ESP config and adding standard NTP settings --- .../device_packages/shelly-plug-series.yaml | 110 ++++++++++++++++++ esphome/esphome-base.yaml | 10 +- 2 files changed, 118 insertions(+), 2 deletions(-) create mode 100644 esphome/device_packages/shelly-plug-series.yaml diff --git a/esphome/device_packages/shelly-plug-series.yaml b/esphome/device_packages/shelly-plug-series.yaml new file mode 100644 index 0000000..02988d2 --- /dev/null +++ b/esphome/device_packages/shelly-plug-series.yaml @@ -0,0 +1,110 @@ +esp8266: + board: esp8285 + +binary_sensor: + - platform: gpio + pin: + number: GPIO13 + inverted: True + name: "${devicename}_button" + on_press: + - switch.toggle: relay + +status_led: + pin: + number: GPIO00 + inverted: True + +output: + - platform: gpio + pin: GPIO02 + inverted: true + id: led + +switch: + - platform: gpio + pin: GPIO15 + id: relay + name: "${channel_1}" + on_turn_on: + - output.turn_on: led + on_turn_off: + - output.turn_off: led + +sensor: + # NTC Temperature + - platform: ntc + sensor: temp_resistance_reading + name: ${devicename} temperature + unit_of_measurement: "°C" + accuracy_decimals: 1 + icon: "mdi:thermometer" + calibration: + b_constant: 3350 + reference_resistance: 10kOhm + reference_temperature: 298.15K + on_value_range: + - above: ${max_temp} + then: + - switch.turn_off: relay + - homeassistant.service: + service: persistent_notification.create + data: + title: Message from ${devicename} + data_template: + message: Switch turned off because temperature exceeded ${max_temp}°C + - platform: resistance + id: temp_resistance_reading + sensor: temp_analog_reading + configuration: DOWNSTREAM + resistor: 32kOhm + - platform: adc + id: temp_analog_reading + pin: A0 + + - platform: hlw8012 + model: BL0937 + sel_pin: + number: GPIO12 + inverted: true + cf_pin: GPIO05 + cf1_pin: GPIO14 + current_resistor: ${current_res} + voltage_divider: ${voltage_div} + current: + name: "${channel_1} current" + unit_of_measurement: "A" + accuracy_decimals: 3 + icon: mdi:flash-outline + voltage: + name: "${channel_1} voltage" + unit_of_measurement: "V" + icon: mdi:flash-outline + power: + name: "${channel_1} power" + id: power + unit_of_measurement: "W" + filters: + - calibrate_linear: + - 0.0 -> 0.0 + - ${power_cal_meas} -> ${power_cal_real} + icon: mdi:flash-outline + on_value_range: + - above: ${max_power} + then: + - switch.turn_off: relay + - homeassistant.service: + service: persistent_notification.create + data: + title: Message from ${devicename} + data_template: + message: Switch turned off because power exceeded ${max_power}W + update_interval: 10s + + - platform: total_daily_energy + name: "${channel_1} daily energy" + power_id: power + filters: + # Multiplication factor from W to kW is 0.001 + - multiply: 0.001 + unit_of_measurement: kWh \ No newline at end of file diff --git a/esphome/esphome-base.yaml b/esphome/esphome-base.yaml index 521f729..8678778 100644 --- a/esphome/esphome-base.yaml +++ b/esphome/esphome-base.yaml @@ -28,9 +28,15 @@ logger: sensor: - platform: wifi_signal - name: "${devicename} WiFi Signal" + name: "${friendly_devicename} Signal" update_interval: 300s switch: - platform: restart - name: "${friendly_devicename} Restart" \ No newline at end of file + name: "${friendly_devicename} Restart" + +time: + - platform: sntp + id: sntp_time + timezone: Europe\Amsterdam + servers: ${ntp} \ No newline at end of file