Hi everybody,
I hope you will excuse my use of a rather morbid title. However I think this could be one of the most important automations in your configuration - that is, if it ever gets triggered.
A dead man’s switch […] is a switch that is automatically operated if the human operator becomes incapacitated, such as through death, loss of consciousness, or being bodily removed from control. Originally applied to switches on a vehicle or machine, it has since come to be used to describe other intangible uses like in computer software. (from Wikipedia)
Concept
The purpose is to make your smart home, aware of an accident, like a fall, that have made you unable to move as a result.
To be clear, it’s not likely that you are gonna have a very bad fall in your home, rendering you unconscious or paralyzed - however, in case it happens you will thank yourself for having some code in place that can take action when you can’t.
Background
A couple of years back, a friend of mine was discovered by her boyfriend, laying on her livingroom floor, paralyzed from her neck down. She had fallen in her own apartment, and as a result, had to go through some operations, and 6 month of intense training. She is relatively fine today, still having some issues with finer motor function.
My point here being, taking the boyfriend out of the equation could dramatically have changed the outcome for my friend. This is scary to think about, but it can be really important to have in mind in case something happens. Ask yourself;
- How often are you expected somewhere?
For me, being a single university student, this is often between 2 or 3 days. And even then, it’s not even sure to curse concern if i don’t show up.
Solution
Have a automation running in HA, that registres if there isn’t any movement when there should be, in other words - A dead man’s switch. The automation, once triggered and conditions are met, should run a script that notify others that you might be in need of assistants via. a siren or something like that.
How this is accomplished if of course dependent on your home setup. In my apartment it would make sense to use a combination of: my phones gps coordinates being “home” for x number of hours as a trigger, and the lack of motion for x number of hours as conditions or vise versa. Whatever route you take, time is gonna be important for the condition.
UPDATE / EDIT
I have removed my initial example in favor for a much more complete one. The system so far consist of 3 entities, 3 automations and 2 scripts, all detailed below
Example
Entities:
input_boolean:
emergency:
name: "Dead man's switch"
initial: off
icon: mdi:robot
emergency_override:
name: "Manual override"
initial: off
icon: mdi:account-check
input_slider:
emergency_override_hours:
name: Override timer
icon: mdi:timer
initial: 20
min: 1
max: 48
step: 1
group:
dms:
name: "Emergency"
entities:
- input_boolean.emergency
- input_boolean.emergency_override
- input_slider.emergency_override_hours
Automations:
### This is the main DMS automation
- alias: 'Dead mans switch triggere'
# It will trigger if the hallway sensor havent seen motion for 14 hours
trigger:
platform: state
entity_id: sensor.bevgelse_i_gang
from: 'True'
to: 'False'
for:
hours: 14
minutes: 0
seconds: 0
condition:
condition: and
conditions:
# Checks if the override is on
- condition: state
entity_id: input_boolean.emergency_override
state: 'off'
# Checks if vacation mode is on
- condition: state
entity_id: input_boolean.vacation_mode
state: 'off'
# Checks if my phone has been home in over 14 hours
- condition: state
entity_id: device_tracker.iphoneGPS
state: 'Home'
for:
hours: 14
minutes: 0
seconds: 0
action:
# Runs a script that sends a DMS triggered notification via my telegram bot
- service: script.turn_on
entity_id: script.emergency_notify
# Turns on the DMS itself
- service: homeassistant.turn_on
entity_id: input_boolean.emergency
#### This automation gives me 15 minutes to disable the DMS manually in case of a falls positiv
- alias: 'Dead mans switch activates 15 minuts after triggering'
trigger:
platform: state
entity_id: input_boolean.emergency
from: 'off'
to: 'on'
for:
hours: 0
minutes: 15
seconds: 0
action:
- service: script.turn_on
entity_id: script.emergency_alarm_triggerd
#### This automation vil disable the manual override after x hours if i forget, or on the off chance that something have happend.
- alias: 'Dead mans switch override disabled after x hours'
trigger:
platform: state
entity_id: input_boolean.emergency_override
from: 'off'
to: 'on'
action:
- delay: '{{ states.input_slider.emergency_override_hours.state | int }}:00:00'
- service: homeassistant.turn_off
entity_id: input_boolean.emergency_override
Scripts
emergency_notify:
sequence:
- service: notify.Alfred
data:
title: '*EMERGENCY NOTIFICATION*'
message: 'The dead man switch have been triggered, you have 15 minuts to respond before the alarm is activated.'
emergency_alarm_triggerd:
sequence:
- service: notify.Alfred
data:
title: '*EMERGENCY NOTIFICATION*'
message: 'The dead man switch have been activated.'
## add lights and sirens goes here
I will be testing this for a week or two before adding actual lights and sirens
How would you set this up in your home?