From b3d0fe4dbd4aaf5c2131c17e375872cc3aa4d6af Mon Sep 17 00:00:00 2001 From: Mahasri Kalavala Date: Sun, 9 Feb 2020 18:33:06 -0500 Subject: [PATCH] minor updates. --- configuration.yaml | 64 +++++++--------------- customize_domain.yaml | 3 +- lovelace/12_automations_view.yaml | 2 +- packages/cameras.yaml | 4 -- packages/door_sensors.yaml | 3 - packages/logger.yaml | 2 - packages/notify.yaml | 17 +++++- packages/paloalto.yaml | 8 +-- packages/rfswitches.yaml | 3 - packages/test.yaml | 1 - packages/tts.yaml | 6 +- packages/xiaomi_aqara.yaml | 15 +++-- packages/zwave_batteries.yaml | 91 +++++++++++++++++++++++-------- templates/goodnight.yaml | 12 ++-- zwcfg_0xd89c4f0c.xml | 64 +++++++++++----------- 15 files changed, 155 insertions(+), 140 deletions(-) diff --git a/configuration.yaml b/configuration.yaml index 4f48b25..0fd49fb 100644 --- a/configuration.yaml +++ b/configuration.yaml @@ -27,34 +27,6 @@ homeassistant: sun: alexa: config: -# cloud: -# alexa: -# filter: -# include_entities: -# - light.family_room -# - light.master_bedroom -# - light.gateway_light_34ce008ad65d -# - switch.basement_left -# - switch.basement_right -# - switch.frontyard_light -# - switch.garage_lights -# - switch.guest_bedroom -# - switch.prayer_room -# - switch.kids_bed_accent -# - switch.kids_bedroom -# - switch.kitchen -# - switch.office_room -# - switch.wemobackyardlightswitch -# - switch.wemoswitch1 -# include_domains: -# - light -# - switch - -# entity_config: -# light.gateway_light_34ce008ad65d: -# name: Gateway Light -# description: Xiaomi Gateway Light - discovery: ignore: - homekit @@ -73,21 +45,26 @@ homekit: - binary_sensor.single_car_garage_door_tilt_sensor_sensor - binary_sensor.two_car_garage_door_tilt_sensor_sensor -sonos: - media_player: - hosts: - - 192.168.1.195 - - 192.168.1.186 - mobile_app: + # map: # updater: # logbook: # history: -websocket_api: -python_script: # recorder: # db_url: !secret my_sql_url +# influxdb: +# host: 192.168.1.125 +# include: +# entities: +# - sensor.dining_room_thermostat_temperature +# - sensor.downstairs_multi_sensor_temperature +# - sensor.front_room_multi_sensor_temperature +# - sensor.guest_bedroom_multi_sensor_temperature +# - sensor.tv_multi_sensor_temperature + +websocket_api: +python_script: logger: !include logging.yaml zeroconf: @@ -109,6 +86,12 @@ mqtt: keepalive: 60 client_id: pi_ha +sonos: + media_player: + hosts: + - !secret sonos_living_room_ip + - !secret sonos_front_room_ip + binary_sensor: - platform: workday country: US @@ -195,12 +178,3 @@ telegram_bot: api_key: !secret telegram_apikey allowed_chat_ids: - !secret telegram_chatid -# influxdb: -# host: 192.168.1.125 -# include: -# entities: -# - sensor.dining_room_thermostat_temperature -# - sensor.downstairs_multi_sensor_temperature -# - sensor.front_room_multi_sensor_temperature -# - sensor.guest_bedroom_multi_sensor_temperature -# - sensor.tv_multi_sensor_temperature diff --git a/customize_domain.yaml b/customize_domain.yaml index 2d9b92b..ee0ca6d 100644 --- a/customize_domain.yaml +++ b/customize_domain.yaml @@ -1,3 +1,2 @@ automation: - initial_state: 'on' - hide_entity: true \ No newline at end of file + initial_state: "on" diff --git a/lovelace/12_automations_view.yaml b/lovelace/12_automations_view.yaml index c2e9ae0..c0aab4a 100644 --- a/lovelace/12_automations_view.yaml +++ b/lovelace/12_automations_view.yaml @@ -53,7 +53,7 @@ cards: - automation.alert_when_someone_enters_a_zone - automation.alert_when_someone_leaves_a_zone - automation.send_a_message_as_i_get_closer_to_home - - automation.update_phone_battery_levels + - automation.update_phone_battery_levels_from_life360 - automation.welcome_family - type: entities diff --git a/packages/cameras.yaml b/packages/cameras.yaml index d423c2e..6655be6 100644 --- a/packages/cameras.yaml +++ b/packages/cameras.yaml @@ -298,7 +298,6 @@ automation: # - alias: Scan Frontdoor Camera On Motion initial_state: true - hide_entity: false trigger: - platform: state entity_id: @@ -378,7 +377,6 @@ automation: # - alias: Scan Driveway Camera When Motion initial_state: true - hide_entity: false trigger: - platform: state entity_id: @@ -458,7 +456,6 @@ automation: # - alias: Scan Garage Camera When Motion initial_state: true - hide_entity: false trigger: - platform: state entity_id: @@ -533,7 +530,6 @@ automation: # - alias: Scan Backyard Camera When Motion initial_state: true - hide_entity: false trigger: - platform: state entity_id: diff --git a/packages/door_sensors.yaml b/packages/door_sensors.yaml index eb7d149..4a3e77c 100644 --- a/packages/door_sensors.yaml +++ b/packages/door_sensors.yaml @@ -132,9 +132,6 @@ automation: ################################################################################ # Notifies when either of the garage door is opened or closed - # When the garage is opened, it sends an actionable ios notification with an - # option to close the garage door. This iso actionable notification only occurs - # when garage door is open and not when it is closed. ############################################################################### - alias: Notify Garage Door Status initial_state: true diff --git a/packages/logger.yaml b/packages/logger.yaml index f4068bc..98adc3a 100644 --- a/packages/logger.yaml +++ b/packages/logger.yaml @@ -69,7 +69,6 @@ # ############################################################################### # - alias: Log Level # initial_state: true -# hide_entity: true # trigger: # - platform: state # entity_id: input_select.log_level @@ -88,7 +87,6 @@ # ############################################################################### # - alias: Restore Log Level on Startup # initial_state: true -# hide_entity: true # trigger: # platform: homeassistant # event: start diff --git a/packages/notify.yaml b/packages/notify.yaml index 4d8c00f..26ae14d 100644 --- a/packages/notify.yaml +++ b/packages/notify.yaml @@ -124,6 +124,8 @@ script: value_template: "{{ states('input_boolean.do_not_disturb') | lower == 'off' }}" - condition: template value_template: "{{ message | trim != '' }}" + - condition: template + value_template: "{{ states('input_boolean.home_mode_away') == 'off' }}" - condition: template value_template: > {% if only_at_night | default('no', true ) == "yes" %} @@ -135,8 +137,13 @@ script: {% else %} true {% endif %} + # - service: sonos.snapshot + # data_template: + # entity_id: media_player.living_room, media_player.upstairs + # - service: sonos.unjoin + # data_template: + # entity_id: media_player.living_room, media_player.upstairs - service: media_player.volume_set - # entity_id: media_player.gstreamer entity_id: media_player.living_room, media_player.upstairs data_template: volume_level: > @@ -152,7 +159,6 @@ script: {% endif %} {% endif %} - service: tts.amazon_polly_say - #entity_id: media_player.gstreamer entity_id: media_player.living_room, media_player.upstairs data_template: cache: true @@ -181,6 +187,12 @@ script: {% set msg = msg + " " + getEndGreeting() %} {% set msg = msg + " " %} {{ msg }} + # - delay: "{{ delay|default('00:00:00') }}" + # - wait_template: "{{ is_state('media_player.living_room', 'playing') }}" + # timeout: "00:00:05" + # - service: sonos.restore + # data_template: + # entity_id: media_player.living_room, media_player.upstairs ############################################################################### # Greeting @@ -188,7 +200,6 @@ script: voice_greeting: sequence: - service: tts.amazon_polly_say - #entity_id: media_player.gstreamer entity_id: media_player.living_room, media_player.upstairs data_template: cache: true diff --git a/packages/paloalto.yaml b/packages/paloalto.yaml index 2dc36bd..b0277a1 100644 --- a/packages/paloalto.yaml +++ b/packages/paloalto.yaml @@ -8,7 +8,7 @@ # homeassistant: # customize: -# # Sensors from custom component +# # Sensors from custom component # sensor.paloalto_host_name: # friendly_name: Palo Alto Host Name # sensor.paloalto_operation_mode: @@ -74,7 +74,6 @@ # - loggedin_user_count # - loggedin_users - # # # # All the URLs below use the following format # # For ex: paloalto_clear_traffic_logs: "curl -k 'https://192.xxx.xxx.xxx/api/?type=op&cmd=&key=YOUR_API_KEY'" @@ -113,7 +112,7 @@ # paloalto_shutdown: # sequence: # - service: shell_command.paloalto_shutdown -# paloalto_restart: +# paloalto_restart: # sequence: # - service: shell_command.paloalto_restart @@ -125,7 +124,6 @@ # # # - alias: Alert When Someone Logged into VPN # initial_state: true -# hide_entity: true # trigger: # - platform: state # entity_id: sensor.paloalto_global_protect_users @@ -169,7 +167,6 @@ # # # - alias: Alert When Someone Logged into Firewall # initial_state: true -# hide_entity: true # trigger: # - platform: state # entity_id: sensor.paloalto_loggedin_users @@ -213,7 +210,6 @@ # # # - alias: Clear Traffic Logs # initial_state: True -# hide_entity: True # trigger: # - platform: time_pattern # hours: '/1' diff --git a/packages/rfswitches.yaml b/packages/rfswitches.yaml index 9285e3a..a234fb2 100644 --- a/packages/rfswitches.yaml +++ b/packages/rfswitches.yaml @@ -100,7 +100,6 @@ # # When the switch state changes (programatically or by UI), save the state to MQTT # - alias: Save RF Switch State # initial_state: true -# hide_entity: true # trigger: # platform: state # entity_id: @@ -120,7 +119,6 @@ # # When the switch state is updated in MQTT (for remove integration), reload the Switch to that state # - alias: Sync MQTT and Switch States # initial_state: true -# hide_entity: true # trigger: # platform: state # entity_id: @@ -144,7 +142,6 @@ # ############################################################################### # - alias: Restore RF Switch Status on Startup # initial_state: true -# hide_entity: true # trigger: # platform: homeassistant # event: start diff --git a/packages/test.yaml b/packages/test.yaml index b1ffaf7..f05a96f 100644 --- a/packages/test.yaml +++ b/packages/test.yaml @@ -157,7 +157,6 @@ # automation: # - alias: Run every 15 seconds -# hide_entity: false # initial_state: true # trigger: # - platform: time_pattern diff --git a/packages/tts.yaml b/packages/tts.yaml index 63c9ceb..3e47022 100644 --- a/packages/tts.yaml +++ b/packages/tts.yaml @@ -13,19 +13,19 @@ input_boolean: input_number: tts_volume_level_morning: name: Morning TTS Volume - initial: 0.3 + # initial: 0.3 min: 0 max: 1 step: 0.1 tts_volume_level_afternoon: name: Afternoon TTS Volume - initial: 0.5 + # initial: 0.5 min: 0 max: 1 step: 0.1 tts_volume_level_evening: name: Evening TTS Volume - initial: 0.3 + # initial: 0.3 min: 0 max: 1 step: 0.1 diff --git a/packages/xiaomi_aqara.yaml b/packages/xiaomi_aqara.yaml index e26680e..616d46c 100644 --- a/packages/xiaomi_aqara.yaml +++ b/packages/xiaomi_aqara.yaml @@ -1,21 +1,20 @@ homeassistant: customize: - binary_sensor.motion_sensor_158d0001a662fe: friendly_name: Kitchen Motion Sensor (Xiaomi) sensor.Illumination_158d0001a662fe: friendly_name: Kitchen Luminance (Xiaomi) - + binary_sensor.motion_sensor_158d0001a25041: friendly_name: Family Room Motion Sensor (xiaomi) sensor.Illumination_158d0001a25041: friendly_name: Family Room Luminance (xiaomi) - + binary_sensor.motion_sensor_158d00016db6d2: friendly_name: Study Room Motion Sensor (Xiaomi) sensor.Illumination_158d00016db6d2: friendly_name: Study Room Luminance (Xiaomi) - + binary_sensor.motion_sensor_158d00016c2d0e: friendly_name: Dining Room Motion Sensor (Xiaomi) sensor.Illumination_158d00016c2d0e: @@ -72,10 +71,14 @@ homeassistant: friendly_name: Front Room Cube (Xiaomi) binary_sensor.cube_158d00027ce15c: friendly_name: Hasika's Bedroom Cube (Xiaomi) - binary_sensor.cube_158d00027cf60d: + binary_sensor.cube_158d00027cf60d: friendly_name: Srinika's Bedroom Cube (Xiaomi) xiaomi_aqara: discovery_retry: 5 gateways: - - key: !secret xiaomi_key \ No newline at end of file + - key: !secret xiaomi_key +# - service: xiaomi_aqara.play_ringtone +# gw_mac: !secret xiaomi_mac +# ringtone_id: 8 +# ringtone_vol: 20 diff --git a/packages/zwave_batteries.yaml b/packages/zwave_batteries.yaml index 257466a..5524e9b 100644 --- a/packages/zwave_batteries.yaml +++ b/packages/zwave_batteries.yaml @@ -82,40 +82,85 @@ automation: mdi:battery-alert {% endif %} - - alias: Update Phone Battery Levels + # - alias: Update Phone Battery Levels + # initial_state: true + # trigger: + # platform: mqtt + # topic: "owntracks/+/+" + # action: + # - service: input_label.set_value + # data_template: + # entity_id: "input_label.{{trigger.topic.split('/')[-1]}}_wifi" + # value: "{{ 'Yes' if trigger.payload_json.conn == 'w' else 'No' }}" + # - service: input_label.set_icon + # data_template: + # entity_id: "input_label.{{trigger.topic.split('/')[-1]}}_wifi" + # value: "{{ 'mdi:wifi' if trigger.payload_json.conn == 'w' else 'mdi:wifi-off' }}" + # - service: input_label.set_name + # data_template: + # entity_id: "input_label.{{trigger.topic.split('/')[-1]}}_wifi" + # value: "{{trigger.topic.split('/')[-1] | title }}'s phone wifi enabled?" + + # - service: input_label.set_value + # data_template: + # entity_id: "input_label.{{trigger.topic.split('/')[-1]}}_battery" + # value: "{{ trigger.payload_json.batt | int }}" + # - service: input_label.set_name + # data_template: + # entity_id: "input_label.{{trigger.topic.split('/')[-1]}}_battery" + # value: "{{trigger.topic.split('/')[-1] | title }}'s Battery" + # - service: input_label.set_icon + # data_template: + # entity_id: "input_label.{{trigger.topic.split('/')[-1]}}_battery" + # value: > + # {% set battery_level = trigger.payload_json.batt | int %} + # {% set battery_round = (battery_level / 10)|int * 10 %} + # {% if trigger.payload_json.charging == 1 %} + # {% if battery_round >= 100 %} + # mdi:battery-charging-100 + # {% elif battery_round > 0 %} + # mdi:battery-charging-{{ battery_round }} + # {% else %} + # mdi:battery-alert + # {% endif %} + # {% else %} + # {% if battery_round >= 100 %} + # mdi:battery + # {% elif battery_round > 0 %} + # mdi:battery-{{ battery_round }} + # {% else %} + # mdi:battery-alert + # {% endif %} + # {% endif %} + + - alias: Update Phone Battery Levels From Life360 initial_state: true trigger: - platform: mqtt - topic: "owntracks/+/+" + - platform: event + event_type: state_changed + condition: + - condition: template + value_template: "{{ trigger.event.data.entity_id is not none }}" + - condition: template + value_template: "{{ 'life360_' in trigger.event.data.entity_id }}" + - condition: template + value_template: "{{ trigger.event.data.new_state.attributes is not none }}" action: - - service: input_label.set_value - data_template: - entity_id: "input_label.{{trigger.topic.split('/')[-1]}}_wifi" - value: "{{ 'Yes' if trigger.payload_json.conn == 'w' else 'No' }}" - - service: input_label.set_icon - data_template: - entity_id: "input_label.{{trigger.topic.split('/')[-1]}}_wifi" - value: "{{ 'mdi:wifi' if trigger.payload_json.conn == 'w' else 'mdi:wifi-off' }}" - service: input_label.set_name data_template: - entity_id: "input_label.{{trigger.topic.split('/')[-1]}}_wifi" - value: "{{trigger.topic.split('/')[-1] | title }}'s phone wifi enabled?" - + entity_id: "input_label.{{- trigger.event.data.entity_id.split('.')[1].split('_')[1] -}}_battery" + value: "{{- trigger.event.data.entity_id.split('.')[1].split('_')[1] |title -}}'s Battery" - service: input_label.set_value data_template: - entity_id: "input_label.{{trigger.topic.split('/')[-1]}}_battery" - value: "{{ trigger.payload_json.batt | int }}" - - service: input_label.set_name - data_template: - entity_id: "input_label.{{trigger.topic.split('/')[-1]}}_battery" - value: "{{trigger.topic.split('/')[-1] | title }}'s Battery" + entity_id: "input_label.{{- trigger.event.data.entity_id.split('.')[1].split('_')[1] -}}_battery" + value: "{{ trigger.event.data.new_state.attributes.battery }}" - service: input_label.set_icon data_template: - entity_id: "input_label.{{trigger.topic.split('/')[-1]}}_battery" + entity_id: "input_label.{{- trigger.event.data.entity_id.split('.')[1].split('_')[1] -}}_battery" value: > - {% set battery_level = trigger.payload_json.batt | int %} + {% set battery_level = trigger.event.data.new_state.attributes.battery | int %} {% set battery_round = (battery_level / 10)|int * 10 %} - {% if trigger.payload_json.charging == 1 %} + {% if trigger.event.data.new_state.attributes.battery_charging == "true" %} {% if battery_round >= 100 %} mdi:battery-charging-100 {% elif battery_round > 0 %} diff --git a/templates/goodnight.yaml b/templates/goodnight.yaml index 6ff9134..5776c78 100644 --- a/templates/goodnight.yaml +++ b/templates/goodnight.yaml @@ -4,12 +4,12 @@ {{- "true" if name.endswith("s") else "false" -}} {%- endmacro -%} - {#- Alerts low battery (below 30%), ONLY when the phone is not already pluggedin -#} + {#- Alerts low battery (below 50% at night), ONLY when the phone is not pluggedin -#} {%- macro low_battery_check() -%} - {%- set level = 30 -%} - {%- for item in states.device_tracker if '_' in item.entity_id.split('.')[1] and state_attr(item.entity_id, "battery") |lower != "none" -%} + {%- set level = 50 -%} + {%- for item in states.device_tracker if 'life360_' in item.entity_id and state_attr(item.entity_id, "battery") |lower != "none" -%} {%- if item.attributes.battery|int < level -%} - {%- if states("sensor." ~ item.friendly_name |lower ~"s_iphone_battery_state") | lower != "charging" %} + {%- if state_attr(item.entity_id, "battery_charging" ) != true %} {{- item.attributes.friendly_name | replace("life360", "") |title }}'s iPhone battery is at {{ item.attributes.battery }} percent. {%- endif %} {%- endif %} @@ -87,8 +87,8 @@ {%- endmacro -%} {%- macro charging_status() -%} - {%- for item in states if "_iphone_battery_state" in item.entity_id and item.state != "Charging" %} - {%- if loop.first %}{% elif loop.last %} and {% else %}, {% endif -%}{{- item.name.split(' ')[0] -}} + {%- for item in states if "life360_" in item.entity_id and item.attributes.battery_charging != True %} + {%- if loop.first %}{% elif loop.last %} and {% else %}, {% endif -%}{{- item.name.split(' ')[1] |title -}} {%- endfor -%} {%- endmacro -%} diff --git a/zwcfg_0xd89c4f0c.xml b/zwcfg_0xd89c4f0c.xml index 4cb94bf..5fc4015 100644 --- a/zwcfg_0xd89c4f0c.xml +++ b/zwcfg_0xd89c4f0c.xml @@ -34,10 +34,10 @@ - + - + @@ -216,9 +216,9 @@ - + - + @@ -350,7 +350,7 @@ - + @@ -390,7 +390,7 @@ - + @@ -415,7 +415,7 @@ - + @@ -490,7 +490,7 @@ - + @@ -720,7 +720,7 @@ - + @@ -728,9 +728,9 @@ - - - + + + @@ -902,7 +902,7 @@ - + @@ -984,7 +984,7 @@ - + @@ -1006,12 +1006,12 @@ - - - - - - + + + + + + @@ -1181,7 +1181,7 @@ - + @@ -1191,7 +1191,7 @@ - + @@ -1213,7 +1213,7 @@ - + @@ -1339,7 +1339,7 @@ - + @@ -1369,7 +1369,7 @@ - + @@ -1703,7 +1703,7 @@ - + @@ -1809,7 +1809,7 @@ - + @@ -2132,7 +2132,7 @@ - + @@ -2405,9 +2405,9 @@ - + - + @@ -2580,7 +2580,7 @@ - + @@ -2782,7 +2782,7 @@ - +