substitutions:
devicename: "aoycocr-eu6s"
friendly_name: "Aoycocr EU6S"
device_description: Aoycocr EU6S Power Monitoring Plug
sp1_current_resistor: "0.00221"
sp1_voltage_divider: "871"
led_pin: GPIO02
esphome:
name: ${devicename}
comment: ${device_description}
friendly_name: ${friendly_name}
esp8266:
board: esp8285
logger:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
ap:
captive_portal:
api:
encryption:
key: !secret encryption_key
ota:
password: !secret ota_password
web_server:
port: 80
time:
- platform: homeassistant
id: homeassistant_time
text_sensor:
- platform: version
name: ${friendly_name} Version
- platform: wifi_info
ip_address:
name: ${friendly_name} IP Address
sensor:
- platform: uptime
name: ${friendly_name} Uptime
- platform: wifi_signal
name: ${friendly_name} Wifi Signal
update_interval: 60s
- platform: hlw8012
sel_pin:
number: GPIO12
inverted: true
cf_pin: GPIO05
cf1_pin: GPIO14
current_resistor: ${sp1_current_resistor}
voltage_divider: ${sp1_voltage_divider}
change_mode_every: 8
update_interval: 60s
current:
name: ${friendly_name} Current
unit_of_measurement: A
accuracy_decimals: 2
voltage:
name: ${friendly_name} Voltage
unit_of_measurement: V
accuracy_decimals: 1
power:
id: power
name: ${friendly_name} Power
unit_of_measurement: W
accuracy_decimals: 0
energy:
id: energy
name: ${friendly_name} Energy
unit_of_measurement: Wh
accuracy_decimals: 0
- platform: total_daily_energy
name: ${friendly_name} Daily Energy Usage
power_id: power
filters:
- multiply: 0.001
unit_of_measurement: kWh
binary_sensor:
- platform: gpio
name: ${friendly_name} Power Button
id: button
pin:
number: GPIO13
inverted: true
on_press:
- switch.toggle: relay
switch:
- platform: restart
name: ${friendly_name} Restart Switch
- platform: gpio
id: relay
name: ${friendly_name} Power Switch
pin: GPIO15
restore_mode: RESTORE_DEFAULT_OFF
on_turn_on:
- switch.turn_on: led
on_turn_off:
- switch.turn_off: led
- platform: gpio
pin: GPIO2
id: led
inverted: True