Turn switch ON at HA reboot event

Hi,

I have a camera in my garage which is turned on/off according to the status of the garage door: If the garage door changes the status from “closed” to “open”, the camera will be turned ON (via switch) and vice versa.

Now I have the problem that when I restart HA whilst the camera is off, the Reolink integration cannot set up the camera during the boot process - hence the camera is not available anymore in HA, even when it is turned ON. So the camera needs to be ON during the boot process.

I now thought about an autmation, which is turning the camera switch ON, at the moment HA restarts. In automation trigger there are only two HA events: Start, Shutdown. I tested both and both are not solving the problem, unfortunately.

Any ideas how to solve this issue?

Thanks for your feedbacks!
Aleardo

Why don’t they solve the issue, what went wrong?

Hi Christoph,

In case of the “start” event the automation itself was triggered and performed correctly, but the camera not integrated though. I assume that the switch ON action was triggered too late for the integration, as the camera needs to be ONE when the integration gets initialized.

The case “Shutdown” was not working and I assume it is because “Shutdown” is not triggered by restarting HA.

Aleardo

check in your router and see if you may change it from pppoe to dhcp.

OK - solved it via an automation which is 1) turning the camera ON after HA start event, 2) re-starting the reolink integration and finally 3) turning the camera OFF again. By doing so, the camera can always be integrated during the start process regardless of it’s status (ON/OFF).

Automation:

alias: Restart Kamera Reolink Integration at HA start
description: ''
trigger:
  - platform: homeassistant
    event: start
condition: []
action:
  - delay:
      hours: 0
      minutes: 2
      seconds: 0
      milliseconds: 0
  - service: switch.turn_on
    data: {}
    target:
      device_id: XXX
  - delay:
      hours: 0
      minutes: 2
      seconds: 0
      milliseconds: 0
  - service: shell_command.reolink_restart
    data: {}
  - delay:
      hours: 0
      minutes: 1
      seconds: 0
      milliseconds: 0
  - service: switch.turn_off
    data: {}
    target:
      device_id: XXX
mode: single

shell_command.reolink_restart:

shell_command:
  reolink_restart: "/usr/bin/curl -X 'POST' -H 'authorization: Bearer <TOKEN>' http://localhost:8123/api/config/config_entries/entry/<ID>"