I have setup an ESP8266 D1 mini NodeMCU with a 1 channel relay module to interrupt power. It’s working fine. My little issue is the relay does not start properly when power is first plug in to the ESP8266. It has a buzzing sound and it looks as though it turned itself on. The only way for the relay to work is not have the output line plug into the esp during a cold startup.
Is there a setting in esphome that can delay sending power to the relay before the esp has boot up fully or my setting below can be improve to prevent this? My concern is if there was a power outage and I am not at home when the power is back on to manually fix that buzzing sound.
substitutions:
name: toilet_airfreshener
platform: ESP8266
board: nodemcuv2
esphome:
name: $name
platform: $platform
board: $board
wifi:
ssid: 'rice'
password: !secret ssid_pass
fast_connect : true
power_save_mode: none
manual_ip:
static_ip: 192.168.1.89
subnet: 255.255.255.0
gateway: 192.168.1.1
captive_portal:
logger:
api:
password: !secret ota_pass
ota:
password: !secret ota_pass
switch:
- platform: gpio
name: $name
id: relay
pin: D4
icon: mdi:spray
restore_mode: ALWAYS_OFF
on_turn_on:
- delay: 12s
- switch.turn_off: relay
sensor:
- platform: wifi_signal
name: $name wifi signal
binary_sensor:
- platform: status
name: $name status
- platform: gpio
pin: D5
name: 'motion tr1 occupancy'
device_class: motion