Created
October 30, 2023 04:25
-
-
Save jrwagz/8a2bf46e8b8e33830abdc7fedd813901 to your computer and use it in GitHub Desktop.
ESPHome Template for Wyze Outdoor Plug, with total daily energy added. Based off of: https://digiblur.com/2023/09/03/wyze-outdoor-plug-esphome-bluetooth-proxy-how-to/#esphome-yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
substitutions: | |
# Higher value gives lower watt readout | |
current_res: "0.001" | |
# Lower value gives lower voltage readout | |
voltage_div: "770" | |
update_time: 10s | |
esphome: | |
name: ${device_name} | |
friendly_name: ${device_name} | |
name_add_mac_suffix: false | |
esp32: | |
board: esp32dev | |
framework: | |
type: esp-idf | |
logger: | |
api: | |
ota: | |
captive_portal: | |
mdns: | |
#web_server: | |
# disabled to due potential memory issues | |
wifi: | |
ssid: !secret wifi_ssid | |
password: !secret wifi_password | |
ap: | |
esp32_ble_tracker: | |
scan_parameters: | |
active: true | |
bluetooth_proxy: | |
active: true | |
switch: | |
- platform: gpio | |
name: Relay1 | |
pin: | |
number: GPIO15 | |
inverted: false | |
restore_mode: ALWAYS_ON | |
id: relay1 | |
on_turn_on: | |
- light.turn_on: relay1_led | |
on_turn_off: | |
- light.turn_off: relay1_led | |
- platform: gpio | |
name: Relay2 | |
pin: | |
number: GPIO32 | |
inverted: false | |
restore_mode: ALWAYS_ON | |
id: relay2 | |
on_turn_on: | |
- light.turn_on: relay2_led | |
on_turn_off: | |
- light.turn_off: relay2_led | |
- platform: restart | |
name: Restart | |
output: | |
- platform: gpio | |
pin: GPIO19 | |
inverted: True | |
id: relay1_led_gpio | |
- platform: gpio | |
pin: GPIO16 | |
inverted: True | |
id: relay2_led_gpio | |
light: | |
- platform: binary | |
name: Relay1 LED | |
id: relay1_led | |
restore_mode: RESTORE_DEFAULT_ON | |
internal: true | |
output: relay1_led_gpio | |
- platform: binary | |
name: Relay2 LED | |
id: relay2_led | |
internal: true | |
output: relay2_led_gpio | |
restore_mode: RESTORE_DEFAULT_ON | |
sensor: | |
- platform: adc | |
pin: GPIO34 | |
name: LUX | |
update_interval: 10s | |
attenuation: 11db | |
- platform: hlw8012 | |
sel_pin: | |
number: GPIO25 | |
inverted: true | |
cf_pin: GPIO27 | |
cf1_pin: GPIO26 | |
current_resistor: ${current_res} | |
voltage_divider: ${voltage_div} | |
change_mode_every: 3 | |
update_interval: 3s | |
current: | |
name: Amps | |
unit_of_measurement: A | |
accuracy_decimals: 2 | |
voltage: | |
name: Volts | |
unit_of_measurement: V | |
accuracy_decimals: 1 | |
power: | |
name: Watts | |
id: plug_power | |
unit_of_measurement: W | |
accuracy_decimals: 0 | |
filters: | |
- calibrate_linear: | |
- 0.0 -> 0.0 | |
- 134 -> 58 | |
- platform: total_daily_energy | |
name: Daily Energy | |
power_id: plug_power | |
filters: | |
- multiply: 0.001 ## convert Wh to kWh | |
unit_of_measurement: kWh | |
binary_sensor: | |
- platform: gpio | |
internal: true | |
pin: | |
number: GPIO18 | |
mode: INPUT_PULLDOWN | |
inverted: True | |
name: Button1 | |
on_press: | |
- switch.toggle: relay1 | |
- platform: gpio | |
internal: true | |
pin: | |
number: GPIO17 | |
mode: INPUT_PULLDOWN | |
inverted: True | |
name: Button2 | |
on_press: | |
- switch.toggle: relay2 | |
status_led: | |
pin: | |
number: GPIO5 | |
inverted: true | |
# Enable time component to reset energy at midnight | |
time: | |
- platform: homeassistant | |
id: homeassistant_time |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment