This blueprint will attempt to keep any switch turned on all the time. This can be useful for any switch that should never be turned off, for example, ZWave plug-in switches that are used solely for power monitoring.
Blueprint Code
blueprint:
name: Always On Switch
description: Keep the selected switch on, even when it is turned off. This should be used for switches you never want to be turned off.
domain: automation
input:
target_switch:
name: Target Switch
description: The switch that will always be kept on.
selector:
entity:
domain: switch
mode: single
max_exceeded: silent
trigger:
- platform: homeassistant
event: start
- platform: state
entity_id: !input target_switch
to: "off"
action:
- service: switch.turn_on
entity_id: !input target_switch