Hi All,
Finally I have my first ESPHome device done and ready to go. I struggle only on 1 thing.
I have created a “switch” because when I touch the touch button it will toggle this switch.
So HA have a entity of this switch and on that I created a automation to turn on and off a light.
Only thing is when I restart the ESP or it lost signal and restart itself the “switch” always turn off so when the lights are on and this happen then the lights go off all.
How can I change this?
I tried this: restore_mode: RESTORE_DEFAULT_OFF
but no success.
esphome:
name: "meek-bathroom"
on_boot:
priority: 600
then:
- switch.turn_on: touch_power
esp8266:
board: nodemcuv2
logger:
level: ERROR
api:
encryption:
key: "HIDDEN"
reboot_timeout: 0s
ota:
safe_mode: true
password: "HIDDEN"
wifi:
ssid: Oudenes.Photography
password: HIDDEN
power_save_mode: light
reboot_timeout: 0s
fast_connect: true
manual_ip:
static_ip: 192.168.100.202
gateway: 192.168.100.1
subnet: 255.255.255.0
mqtt:
broker: 192.168.100.24
username: HIDDEN
password: HIDDEN
client_id: esphome-bathroom
topic_prefix: esphome/bathroom
discovery: true
reboot_timeout: 0s
light:
- platform: neopixelbus
default_transition_length: 0s
type: GRB
variant: 800KBPS
pin: D4 #GPIO2
num_leds: 1
name: "ESPHome bathroom - Neopixel"
restore_mode: ALWAYS_ON
id: neopixel
button:
- platform: factory_reset
name: "ESPHome bathroom - reset"
switch:
- platform: gpio
pin: D1 #GPIO1
name: "ESPHome bathroom - Switch 1"
id: switch1
- platform: gpio
pin: D1 #GPIO16
name: "ESPHome bathroom - Touch 1 power"
id: touch_power
- platform: safe_mode
name: "ESPHome bathroom - safe mode"
text_sensor:
- platform: wifi_info
ip_address:
name: "ESPHome bathroom - IP"
ssid:
name: "ESPHome bathroom - SSID"
bssid:
name: "ESPHome bathroom - BSSID"
mac_address:
name: "ESPHome bathroom - Mac"
- platform: version
name: "ESPHome bathroom - Version"
hide_timestamp: true
binary_sensor:
- platform: gpio
pin: D6 #GPIO12
name: "ESPHome bathroom - Touch 1"
discovery: false
on_press:
- switch.toggle: switch1
- if:
condition:
switch.is_on: switch1
then:
- light.turn_on:
id: neopixel
brightness: 100%
red: 0%
green: 100%
blue: 0%
- if:
condition:
switch.is_off: switch1
then:
- if:
condition:
lambda: |-
return id(goodnight).state > 0;
then:
- light.turn_on:
id: neopixel
brightness: 100%
red: 10%
green: 0%
blue: 10%
- if:
condition:
lambda: |-
return id(kodi).state > 0;
then:
- light.turn_on:
id: neopixel
brightness: 100%
red: 93%
green: 0%
blue: 93%
- if:
condition:
lambda: |-
return id(daytime).state > 0;
then:
- light.turn_on:
id: neopixel
brightness: 100%
red: 100%
green: 0%
blue: 0%
- if:
condition:
lambda: |-
return id(evening).state > 0;
then:
- light.turn_on:
id: neopixel
brightness: 100%
red: 100%
green: 0%
blue: 0%
- if:
condition:
lambda: |-
return id(appletv).state > 0;
then:
- light.turn_on:
id: neopixel
brightness: 100%
red: 55%
green: 55%
blue: 0%
- if:
condition:
lambda: |-
return id(tv).state > 0;
then:
- light.turn_on:
id: neopixel
brightness: 100%
red: 0%
green: 25%
blue: 53%
- if:
condition:
lambda: |-
return id(nintendo).state > 0;
then:
- light.turn_on:
id: neopixel
brightness: 100%
red: 36%
green: 28%
blue: 55%
sensor:
- platform: wifi_signal
name: "ESPHome bathroom - wifi Signal"
update_interval: 60s