From 64c7f6ed1f75e92acff4e3cf0872be02b44856e3 Mon Sep 17 00:00:00 2001 From: Adam Dodman Date: Tue, 29 Nov 2016 17:15:25 +0000 Subject: [PATCH] Initial Commit --- automation/pill_reminder.yaml | 35 +++++++++++++++++ configuration.yaml | 74 +++++++++++++++++++++++++++++++++++ notify.yaml | 8 ++++ scripts/toggle_pill.yaml | 13 ++++++ sensor.yaml | 36 +++++++++++++++++ 5 files changed, 166 insertions(+) create mode 100644 automation/pill_reminder.yaml create mode 100644 configuration.yaml create mode 100644 notify.yaml create mode 100644 scripts/toggle_pill.yaml create mode 100644 sensor.yaml diff --git a/automation/pill_reminder.yaml b/automation/pill_reminder.yaml new file mode 100644 index 0000000..e7b6a26 --- /dev/null +++ b/automation/pill_reminder.yaml @@ -0,0 +1,35 @@ +- alias: Pill Morning Reset + trigger: + platform: time + hours: 06 + minutes: 0 + seconds: 0 + action: + - service: script.turn_on + entity_id: script.toggle_pill + +- alias: Pill Notification Check + trigger: + platform: time + hours: 13 + minutes: 0 + seconds: 0 + condition: + condition: numeric_state + entity_id: sensor.last_pill + above: 25000 + action: + - service: notify.adams_android + data: + title: 'Take your pills!' + message: 'Take your pills you lazy shit!' + +- alias: Pill Afternoon Reset + trigger: + platform: time + hours: 13 + minutes: 0 + seconds: 10 + action: + - service: script.turn_on + entity_id: script.toggle_pill diff --git a/configuration.yaml b/configuration.yaml new file mode 100644 index 0000000..a3a046e --- /dev/null +++ b/configuration.yaml @@ -0,0 +1,74 @@ +homeassistant: + # Name of the location where Home Assistant is running + name: Home + # Location required to calculate the time the sun rises and sets + latitude: !secret home_lat + longitude: !secret home_long + # Impacts weather/sunrise data (altitude above sea level in meters) + elevation: 55 + # metric for Metric, imperial for Imperial + unit_system: metric + # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones + time_zone: Europe/London + + +# Enables the frontend +frontend: + +http: + # Uncomment this to add a password (recommended!) + api_password: !secret api_password + +# Checks for available updates +updater: + +# Discover some devices automatically +discovery: + +# Allows you to issue voice commands from the frontend in enabled browsers +conversation: + +# Enables support for tracking state changes over time. +history: + +# View all events in a logbook +logbook: + +# Track the sun +sun: + +# Embedded MQTT Broker +mqtt: + +notify: !include notify.yaml + +sensor: !include sensor.yaml + +media_player: + - platform: samsungtv + name: Adams TV + host: 192.168.1.170 + - platform: snapcast + host: 192.168.1.60 + - platform: mpd + host: 192.168.1.60 + location: Multi-Room + - platform: mpd + host: 192.168.1.61 + location: Den + - platform: mpd + host: 192.168.1.62 + location: Bedroom + +device_tracker: + - platform: luci + host: 192.168.1.1 + username: !secret luci_user + password: !secret luci_pass + interval_seconds: 20 + consider_home: 300 + track_new_devices: no + +script: !include_dir_named scripts + +automation: !include_dir_merge_list automation diff --git a/notify.yaml b/notify.yaml new file mode 100644 index 0000000..9915753 --- /dev/null +++ b/notify.yaml @@ -0,0 +1,8 @@ +### Notify: + +#Adams Phone +- name: Adams Android + platform: pushover + api_key: !secret pushover_api + user_key: !secret pushover_user + diff --git a/scripts/toggle_pill.yaml b/scripts/toggle_pill.yaml new file mode 100644 index 0000000..ebf39f8 --- /dev/null +++ b/scripts/toggle_pill.yaml @@ -0,0 +1,13 @@ +sequence: + - service: mqtt.publish + data: + topic: dash/pill_reminder + payload: 'ON' + qos: 1 + - delay: + seconds: 1 + - service: mqtt.publish + data: + topic: dash/pill_reminder + payload: 'OFF' + qos: 1 diff --git a/sensor.yaml b/sensor.yaml new file mode 100644 index 0000000..f8090b3 --- /dev/null +++ b/sensor.yaml @@ -0,0 +1,36 @@ +# Temp and Humidity Monitoring +- platform: mqtt + state_topic: 'tortoise/sensor1' + name: 'Temperature' + unit_of_measurement: '°C' + value_template: '{{ value_json.temperature }}' +- platform: mqtt + state_topic: 'tortoise/sensor1' + name: 'Humidity' + unit_of_measurement: '%' + value_template: '{{ value_json.humidity }}' + +# Plex Media Server +- platform: plex + name: Plex Sensor + host: 192.168.1.3 + +#### Pill Time Counters### + +#Current Time +- platform: time_date + display_options: + - 'date_time' +# Seconds since Pill Button Sensor changed +- platform: template + sensors: + last_pill: + unit_of_measurement: Sec + friendly_name: Pill Last Taken + value_template: '{% if states.sensor.pill_button_sensor.last_updated is undefined %}{{"00:00:00"}}{% else %}{{ ((as_timestamp(states.sensor.date__time.last_updated)-as_timestamp(states.sensor.pill_button_sensor.last_updated))|int) }}{% endif %}' + +# Push Button Sensor +- platform: mqtt + name: Pill Button Sensor + state_topic: 'dash/pill_reminder' + hide: false