Skip to content

Commit

Permalink
iOS Notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
lolouk44 committed Mar 9, 2018
1 parent 4c0c491 commit 8dfc55f
Show file tree
Hide file tree
Showing 5 changed files with 182 additions and 12 deletions.
22 changes: 10 additions & 12 deletions alerts/Alerts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -203,17 +203,16 @@ root_disk_usage_too_high:
notifiers:
- pushbullet

# basil_humidity_too_low:
# name: Basil Humidity below 15%
# entity_id: binary_sensor.basil_humidity_too_low
# can_acknowledge: True
# skip_first: True
# repeat:
# - 5
# - 240
# notifiers:
# - pushbullet
# - gmaillolo
basil_humidity_too_low:
name: Basil Humidity below 15%
entity_id: binary_sensor.basil_humidity_too_low
can_acknowledge: True
skip_first: True
repeat:
- 5
- 240
notifiers:
- pushbullet

basil_battery_too_low:
name: Basil Battery below 10%
Expand All @@ -225,7 +224,6 @@ basil_battery_too_low:
- 240
notifiers:
- pushbullet
- gmaillolo



Expand Down
157 changes: 157 additions & 0 deletions automation/iOS.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
- alias: Notify iOS app
trigger:
- platform: state
entity_id: alert.basil_battery_too_low
from: 'idle'
to: 'on'
- platform: state
entity_id: alert.basil_humidity_too_low
from: 'idle'
to: 'on'
- platform: state
entity_id: alert.cctv_dafang_kitchen_lost
from: 'idle'
to: 'on'
- platform: state
entity_id: alert.cctv_dafang_living_room_lost
from: 'idle'
to: 'on'
- platform: state
entity_id: alert.cctv_front_lost
from: 'idle'
to: 'on'
- platform: state
entity_id: alert.cctv_garage_lost
from: 'idle'
to: 'on'
- platform: state
entity_id: alert.currentcost_lost
from: 'idle'
to: 'on'
- platform: state
entity_id: alert.dehumidifier_full
from: 'idle'
to: 'on'
- platform: state
entity_id: alert.home_disk_usage_too_high
from: 'idle'
to: 'on'
- platform: state
entity_id: alert.house_number_led_strip_lost
from: 'idle'
to: 'on'
- platform: state
entity_id: alert.outside_temp_sensor_lost
from: 'idle'
to: 'on'
- platform: state
entity_id: alert.ram_too_high
from: 'idle'
to: 'on'
- platform: state
entity_id: alert.root_disk_usage_too_high
from: 'idle'
to: 'on'
- platform: state
entity_id: alert.rpi_lost
from: 'idle'
to: 'on'
- platform: state
entity_id: alert.rpi_zero_w_lost
from: 'idle'
to: 'on'
- platform: state
entity_id: alert.staircase_led_strip_lost
from: 'idle'
to: 'on'
- platform: state
entity_id: alert.tv_cabinet_led_strip_lost
from: 'idle'
to: 'on'
- platform: state
entity_id: alert.upstairs_temp_sensor_lost
from: 'idle'
to: 'on'
action:
- service: counter.increment
entity_id: counter.iosbadgecount
- service: notify.ios_lolos_iphone
data_template:
message: '{{ trigger.entity_id | replace("alert.","") | replace("_"," ") |capitalize }}'
data:
push:
badge: '{{states.counter.iosbadgecount.state}}'
category: "alert"
action_data:
entity_id: '{{trigger.entity_id}}'

- alias: Turn Alert Off
trigger:
- platform: event
event_type: ios.notification_action_fired
event_data:
actionName: DISABLE_ALERT
action:
- service: alert.turn_off
data_template:
entity_id: '{{ trigger.event.data["action_data"]["entity_id"] }}'

- alias: Decrease Counter with Alert to Idle
trigger:
- platform: state
entity_id: alert.basil_battery_too_low
to: 'idle'
- platform: state
entity_id: alert.basil_humidity_too_low
to: 'idle'
- platform: state
entity_id: alert.cctv_dafang_kitchen_lost
to: 'idle'
- platform: state
entity_id: alert.cctv_dafang_living_room_lost
to: 'idle'
- platform: state
entity_id: alert.cctv_front_lost
to: 'idle'
- platform: state
entity_id: alert.cctv_garage_lost
to: 'idle'
- platform: state
entity_id: alert.currentcost_lost
to: 'idle'
- platform: state
entity_id: alert.dehumidifier_full
to: 'idle'
- platform: state
entity_id: alert.home_disk_usage_too_high
to: 'idle'
- platform: state
entity_id: alert.house_number_led_strip_lost
to: 'idle'
- platform: state
entity_id: alert.outside_temp_sensor_lost
to: 'idle'
- platform: state
entity_id: alert.ram_too_high
to: 'idle'
- platform: state
entity_id: alert.root_disk_usage_too_high
to: 'idle'
- platform: state
entity_id: alert.rpi_lost
to: 'idle'
- platform: state
entity_id: alert.rpi_zero_w_lost
to: 'idle'
- platform: state
entity_id: alert.staircase_led_strip_lost
to: 'idle'
- platform: state
entity_id: alert.tv_cabinet_led_strip_lost
to: 'idle'
- platform: state
entity_id: alert.upstairs_temp_sensor_lost
to: 'idle'
action:
- service: counter.decrement
entity_id: counter.iosbadgecount
3 changes: 3 additions & 0 deletions counters/iOS.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- iosbadgecount:
name: iOS Badge Count
icon: mdi:numeric-1-box
1 change: 1 addition & 0 deletions groups/Alerts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ Alerts:
- alert.cctv_dafang_kitchen_lost
- alert.basil_humidity_too_low
- alert.basil_battery_too_low
- counter.iosbadgecount
11 changes: 11 additions & 0 deletions iOS.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
push:
categories:
- name: Alert
identifier: 'alert'
actions:
- identifier: 'DISABLE_ALERT'
title: 'Disable Alert'
activationMode: 'background'
authenticationRequired: yes
destructive: yes
behavior: 'default'

0 comments on commit 8dfc55f

Please sign in to comment.