update to make it work with latest esphome revisions of 12.2023

This commit is contained in:
DonPavlov 2024-01-02 14:55:00 +01:00
parent 59214309b8
commit 4b092e366b
1 changed files with 27 additions and 19 deletions

View File

@ -4,16 +4,18 @@ substitutions:
esphome: esphome:
name: "${name}" # choose your own name
name: WakeOnLan
friendly_name: PC
platform: ESP8266 platform: ESP8266
board: nodemcuv2 board: d1_mini
project: project:
name: "ajfriesen.pc-switch" name: "ajfriesen.pc-switch"
version: "1.0.0" version: "1.1.0"
# Enable logging # Enable logging if needed
logger: logger: null
# Enable Home Assistant API # Enable Home Assistant API
api: api:
@ -23,22 +25,26 @@ dashboard_import:
# Put ota password here # Put ota password here
ota: ota:
safe_mode: true
password: ota_password
# Your wifi config # Your wifi config
wifi: wifi:
# ssid: "" ssid: wifi_ssid
# password: "" password: wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails # Enable fallback hotspot (captive portal) in case wifi connection fails
ap: ap:
ssid: "PC-Switch Fallback Hotspot" ssid: "PC-Switch Fallback Hotspot"
password: "fallback-wifi" password: fallback-wifi
captive_portal: captive_portal:
switch: switch:
- platform: gpio - platform: gpio
pin: D6 pin:
number: D6
allow_other_uses: true
id: power_switch id: power_switch
internal: true internal: true
on_turn_on: on_turn_on:
@ -46,7 +52,9 @@ switch:
- switch.turn_off: power_switch - switch.turn_off: power_switch
- platform: gpio - platform: gpio
pin: D6 pin:
number: D6
allow_other_uses: true
id: power_switch_force id: power_switch_force
internal: true internal: true
on_turn_on: on_turn_on:
@ -64,31 +72,31 @@ binary_sensor:
- platform: gpio - platform: gpio
pin: D0 pin: D0
id: pc_power_sensor id: pc_power_sensor
name: "${name} Power State" name: Power State
device_class: power device_class: power
icon: "mdi:desktop-classic" icon: mdi:desktop-classic
button: button:
- platform: template - platform: template
name: "${name} Power Button" name: Power Button
id: power_button id: power_button
icon: "mdi:power-standby" icon: mdi:power-standby
on_press: on_press:
then: then:
- switch.toggle: power_switch - switch.toggle: power_switch
- platform: template - platform: template
name: "${name} Force Power Off" name: Force Power Off
id: force_power_off id: force_power_off
icon: "mdi:power-plug-off" icon: mdi:power-plug-off
on_press: on_press:
then: then:
- switch.toggle: power_switch_force - switch.toggle: power_switch_force
- platform: template - platform: template
name: "${name} Reset Button" name: Reset Button
id: reset_button id: reset_button
icon: "mdi:restart" icon: mdi:restart
on_press: on_press:
then: then:
- switch.toggle: reset_switch - switch.toggle: reset_switch