Prevent ESPHome to automatically start after power outage/upgrade?

I have a oil difusser that have ESPHome installed to control it.
My question is, everytime I upgrade or have a power outage the oil diffuser turns on and start to blow out the “steam”.

Is there a way so that it doesn’t turn on at upgrades or power outage and so on?

Most likely.
Post your yaml.

1 Like

Bellow is the code in my yaml file

# Asakuki Oil Diffuser

substitutions:
  node_name: "asakuki"
  device_name: "Asakuki"

esphome:
  name: $node_name
  name_add_mac_suffix: false
  comment: $device_name

esp8266:
  board: esp01_1m

wifi:
  networks:
    - ssid: !secret wifi_ssid
      password: !secret wifi_password
  use_address: 192.168.25.59

#Fallback WIFI
  ap:
    ssid: "$node_name"
    password: !secret wifi_password

#Captive Portal
captive_portal:

# Enable wireless updates
http_request:
   verify_ssl: "false"

ota:
  platform: esphome
  password: !secret ota_pwd
  
# Enable webserver  
web_server:
  port: 80
  auth:
    username: admin
    password: !secret wifi_password

# Enable Home Assistant API
api:

# enable tuya sensor platform
tuya:

binary_sensor:
- platform: "tuya"
  name: $device_name out of water
  id: empty
  sensor_datapoint: 12
  device_class: "problem"

switch:
# Turn the mist on and off
  - platform: template
    name: $device_name Diffuser
    optimistic: true
    turn_on_action:
      - uart.write: [0x55, 0xAA, 0x00, 0x06, 0x00, 0x05, 0x67, 0x04, 0x00, 0x01, 0x01, 0x77]
    turn_off_action:
      - uart.write: [0x55, 0xaa, 0x00, 0x06, 0x00, 0x05, 0x67, 0x04, 0x00, 0x01, 0x02, 0x78]
      - uart.write: [0x55, 0xaa, 0x00, 0x06, 0x00, 0x05, 0x6e, 0x04, 0x00, 0x01, 0x01, 0x7E]

# VITAL diffuser may crash if not set
uart:
  baud_rate: 9600
  tx_pin: GPIO1
  rx_pin: GPIO3

# Enable logging
logger:
  baud_rate: 0

Just plain template switch, interesting…
I don’t know why it’s switching on boot, default restore should be off.
Try to add this to switch:
restore_mode: disabled

1 Like

Yes, that did the trick.

Works now, It doesn’t start after I pull the power cable or after I do an update of the code.

Thank you so much.

You are welcome!
I wonder why Esphome toggles template switch on boot with default restore though…