Turn on a switch on startup

Hey guys,

I cant find how to turn on a switch on startup.

Im using UART switches to control my tv, but if the device just boots, I need to send a blank switch with a NL and CR to clear the buffer on the TV.

Basically, I just need a switch to turn on when the boot completes on the node.

Cant find it in the docs, any help please ? :slight_smile:

Not sure I quite understand you’re setup, but you should be able to create an automation with a trigger for homeassistant start.

Just write an automation to turn the switch on when HA reboots/starts

  trigger:
    platform: homeassistant
    event: start
  condition:
      condition: template
      value_template: '{{ states.sensor.uptime.state > "0.01" }}'
  action:
    service: switch.turn_on
    entity_id: switch.yourswitch

If you are trying to do this in ESPHome, i would think using these two references should get you there.

First, UART automation, “uart.write…”

Once you know what you need, the “on…” part could be done on boot so that everytime the ESP device reboots the signal is sent:

See if that gets you what you are trying to accomplish!

Good Luck!
DeadEnd

1 Like

Not HA boot, the esphome device ! @brahmafear @kanda_who

Thanks DeadEnd!!! Second link is exactly what I need

Please mark deadends post as the solution to your issue, it helps others differentiate if I’m looking for a similar solution AND doesn’t waste my time if I’m trying to help people :wink:
Glad you found a solution

Note: the I and MY above were not ME specifically but ANYONE on the forum.
I re-read my post and it seemed like I was irritated :crazy_face:

1 Like