Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bed presence sensor and automations #205

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions automation/bed_departure.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
alias: Alert when someone leaves the bed
trigger:
- platform: state
entity_id: binary_sensor.charlotte_bed_sensor
from: 'On'
to: 'Off'
# for:
# minutes: 2
- platform: state
entity_id: binary_sensor.kyle_bed_sensor
from: 'On'
to: 'Off'
# for:
# minutes: 2

action:
- service: notify.email_kyle
data_template:
message: '{{trigger.to_state.attributes.friendly_name}} has gone off.'
title: Bed alert
45 changes: 45 additions & 0 deletions esphome/bed_sensor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
substitutions:
device_name: bed_sensor
device_description: Bed Sensor
friendly_name: Bed Sensor

packages:
common: !include common/common.yaml

esphome:
name: ${device_name}
comment: ${device_description}
platform: ESP8266
board: d1_mini

# Enable logging
logger:

web_server:

binary_sensor:
- platform: gpio
pin:
number: D4
mode: INPUT_PULLUP
filters:
- invert:
name: "Bed Contact Sensor 1"
- platform: gpio
pin:
number: D3
mode: INPUT_PULLUP
filters:
- invert:
name: "Bed Contact Sensor 2"

sensor:
- platform: wifi_signal
name: "Bed Sensor WiFi signal"
update_interval: 60s

status_led:
pin:
number: D8
inverted: yes