[
  {
    "path": ".gitignore",
    "content": "*.pid\n*.xml\n*.csr\n*.crt\n*.key\nwww\nOZW_Log.txt\nhome-assistant.log\nhome-assistant_v2.db\n*.db-journal\nlib\ndeps\ntts\nsecrets.yaml\nknown_devices.yaml\n*.conf\nplex.conf\nphue.conf\nharmony_media_room.conf\npyozw.sqlite\n.*\n!/.gitignore\n!/.travis.yml\nhtml5_push_registrations.conf\nip_bans.yaml\n/icloud/*\nozw_config\nemulated_hue_ids.json\n"
  },
  {
    "path": ".travis.yml",
    "content": "language: python\npython:\n  - \"3.6\"\ninstall:\n  - pip3 install homeassistant\nscript:\n  - hass -c . --script check_config\nbefore_install:\n  - mv travis_secrets.yaml secrets.yaml\n"
  },
  {
    "path": "LICENSE",
    "content": "Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [yyyy] [name of copyright owner]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License."
  },
  {
    "path": "README.md",
    "content": "# [![Build Status](https://travis-ci.org/notoriousbdg/Home-AssistantConfig.svg?branch=master)](https://travis-ci.org/notoriousbdg/Home-AssistantConfig) My [Home Assistant](https://home-assistant.io/) Config\n"
  },
  {
    "path": "automations.yaml",
    "content": "[]"
  },
  {
    "path": "configuration.yaml",
    "content": "homeassistant:\n  # Name of the location where Home Assistant is running\n  name: Home\n  # Location required to calculate the time the sun rises and sets\n  latitude: !secret home_latitude\n  longitude: !secret home_longitude\n  # Impacts weather/sunrise data (altitude above sea level in meters)\n  elevation: !secret home_elevation\n  # metric for Metric, imperial for Imperial\n  unit_system: imperial\n  # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones\n  time_zone: !secret home_timezone\n  #customize: !include customize.yaml\n\n# Show links to resources in log and frontend\n#introduction:\n\n# Enables the frontend\nfrontend:\n\n# Enables configuration UI\nconfig:\n\nhttp:\n  # Uncomment this to add a password (recommended!)\n  api_password: !secret http_api_password\n  #ssl_certificate: !secret ssl_certificate\n  #ssl_key: !secret ssl_key\n  #base_url: !secret base_url\n  #server_port: !secret server_port\n  trusted_networks:\n    - 127.0.0.1\n    - ::1\n    - !secret trusted_ip\n  ip_ban_enabled: True\n  login_attempts_threshold: 5\n\n# Checks for available updates\n# Note: This component will send some information about your system to\n# the developers to assist with development of Home Assistant.\n# For more information, please see:\n# https://home-assistant.io/blog/2016/10/25/explaining-the-updater/\nupdater:\n  # Optional, allows Home Assistant developers to focus on popular components.\n  # include_used_components: true\n\n# Discover some devices automatically\ndiscovery:\n\n# Allows you to issue voice commands from the frontend in enabled browsers\nconversation:\n\n# Enables support for tracking state changes over time.\nhistory:\n\n# View all events in a logbook\nlogbook:\n\n# Track the sun\nsun:\n\n# Weather Prediction\nsensor:\n  platform: yr\n\n# Text to speech\ntts:\n  platform: google\n\ngroup: !include groups.yaml\nautomation: !include automations.yaml\n\n#zone: !include zones.yaml\n#sensor: !include sensors.yaml\n#switch: !include switches.yaml\n#device_tracker: !include device_tracker.yaml\n\nffmpeg:\n  ffmpeg_bin: /usr/bin/ffmpeg\n\nmqtt:\n  broker: !secret mqtt_broker_ip\n  port: !secret mqtt_port\n  client_id: !secret mqtt_client_id\n  username: !secret mqtt_username\n  password: !secret mqtt_password\n  discovery: true\n  discovery_prefix: homeassistant\n"
  },
  {
    "path": "customize.yaml",
    "content": ""
  },
  {
    "path": "device_tracker.yaml",
    "content": ""
  },
  {
    "path": "gitupdate.sh",
    "content": "#!/bin/bash\n\ncd /home/homeassistant/.homeassistant\nsource /srv/homeassistant/homeassistant_venv/bin/activate\nhass --script check_config\n\ngit add .\ngit status\necho -n \"Enter the Description for the Change: \" [Minor Update]\nread CHANGE_MSG\ngit commit -m \"${CHANGE_MSG}\"\ngit push origin master\n\nexit\n\n"
  },
  {
    "path": "groups.yaml",
    "content": ""
  },
  {
    "path": "packages/battery_alert.yaml",
    "content": "################################################################\n## Battery Alert Package by NotoriousBDG\n##\n## Source: https://raw.githubusercontent.com/notoriousbdg/Home-AssistantConfig/master/packages/battery_alert.yaml\n################################################################\n\n################################################################\n## Changelog\n################################################################\n##\n## 1.0.0 (2018-02-14)\n##   Added\n##   - Added version number to enable better tracking\n##\n## 1.0.1 (2018-02-15)\n##   Added\n##   - Added battery_sensor_creation_disabled attibute to skip\n##     creating a battery sensor even when an battery attribute\n##     exists.\n##\n## 1.0.2 (2018-04-06)\n##   Added\n##   - Added battery icon to sensors.\n##\n## 1.0.3 (2018-05-10)\n##   Changed\n##   - Change device_class to battery and remove icon, which\n##     allows dynamic icons in 0.69.\n##\n## 1.0.4 (2018-05-11)\n##   Changed\n##   - Fixed condition battery_sensor_creation_disabled condition\n##   Added\n##   - Documented a jinja template that can be use to assist\n##     with creating a group containing all battery sensors.\n##\n## 1.0.5 (2018-05-14)\n##   Changed\n##   - Changed formatting of notifications to improve readability\n##   - Nofity via Slack immediately when thresholds are modified\n##   Added\n##   - Entities with device_class of battery no longer need\n##     battery in their friendly name to be monitored\n##   - Don't create a battery sensor from an entity if\n##     device_class is battery\n##\n## 1.0.6 (2018-05-14)\n##   Changed\n##   - Added object_id to notifications\n##   - Updated Battery Status group jinja code to check for\n##     battery device_class\n##\n## 1.0.7 (2018-05-16)\n##   Added\n##   - Added unique_id to disambiguate sensors with duplicate\n##     names\n##   - Added source info to mqtt config topic\n##   - Consider friendly names and entity_ids that end with _bat\n##     as a battery sensor (needed for rflink battery sensors)\n##   - Consider entities with icon of battery, battery-alert, or\n##     battery-unknown as a battery sensor regardles of its name\n##   - Consider entity_ids containing battery as a battery sensor\n##   Changed\n##   - Reduce code duplication using yaml anchors and references\n##   - Changed MQTT topic to be based on entity_id\n##   - Improve method of filtering non-battery devices that have\n##     battery in their name. Detection is now based on icon\n##     rather than keywords.\n##\n## 1.0.8 (2018-06-01)\n##   Added\n##   - Add support for defining battery_template attibute to\n##     allow manipulation of value of battery sensor\n##   - Support battery attributes that contain strings\n##   Removed\n##   - Cleaned up notifications by removing object id\n##\n## 1.0.9 (2018-06-08)\n##   Added\n##   - Automatically create Battery Status group containing all\n##     discovered batteries\n##   Removed\n##   - Removed sample jinja to create battery status group yaml\n##\n## 1.0.10 (2018-06-08)\n##   Added\n##   - Moved group.update_battery_status_group_members to Battery\n##     Alert group\n##\n## 1.1.0 (2018-08-09)\n##   Added\n##   - Added Batteries view\n##   - Added Telegram notification automation\n##   - Added Pushover notification automation\n##   - Added attributes to battery entities created via mqtt:\n##     entity_id, attribute, mqtt_config_topic, and mqtt_state_topic\n##   Changed\n##   - Simplified trigger for update_battery_status_group_members\n##     automation\n##   - Refactored conditions on automations to rely on\n##     group.battery_status members\n##   Breaking Changes\n##   - The attribute additions requires restarting Home Assistant\n##     after the first state change or clearing retained MQTT topics\n##\n## 1.1.1 (2018-08-11)\n##   Added\n##   - Added input text box named `MQTT Topic to Clear`, which can be used\n##     to clear MQTT topics with retained messages\n##   - Set initial_state to on for all automations to ensure they are enabled\n##     on startup\n##   Changed\n##   - Consider entities with battery in their entity_id or friendly_name a\n##     battery sensor if neither an icon nor a device class is defined\n##   - Consolidated the battery_sensor_from_* automations into a single\n##     automation\n##\n## 1.1.2 (2018-08-23)\n##   Fixed\n##   - Fixed issue where non-battery sensors with Battery in their name are\n##     added to group.battery_status\n##\n## 1.1.3 (2018-11-17)\n##   Fixed\n##   - Filter out trigger=none from automation.battery_sensor_from_attributes\n##   - Don't convert float to int in mqtt payload\n##\n## 1.1.4 (2018-11-17)\n##   Fixed\n##   - Ignore entities with null states\n##   - Fix issue causing TypeError: object of type 'NoneType' has no len()\n##\n## 1.1.5 (2018-11-18)\n##   Added\n##   - Add support for defining battery_template_string attibute to\n##     support templates that return strings\n##\n## 1.1.6 (2018-11-21)\n##   Removed\n##   - Removed attribute named attribute on the sensors\n##   Added\n##   - Added attribute to the MQTT sensors with the same name and value as the\n##     original entity\n##\n## 1.2.0 (2019-01-20)\n##   Breaking Changes\n##   - Setting up notifications have changed.  Enter the name of the notifier in the `Notifier Name` input text box\n##     and select the notifier format using the `Notifier Format` input select.\n##   Changed\n##   - Migrate attributes from json_attributes to json_attributes_topic\n##   - Remove % unit for battery level attributes that contain strings\n##   - Replaced mqtt_config_topic and mqtt_state_topic attributes with delete_battery_sensor attribute\n##     to make deleting battery sensors easier\n##   - Renamed MQTT Topic to Clear input text box to Delete a Battery Sensor\n##   Added\n##   - Battery attributes containing strings now have dynamic icons that change with battery status\n##   - Added Notifier Name input text box to store name of the notifier to use for notifications (defaults to notify.notify)\n##   - Added Notifier Format input select to allow selection of notification format.  Options are Default and Slack.\n##   - Added input_boolean.low_batteries to help with automations.  True means there are low batteries.\n##\n## 1.2.1 (2019-01-23)\n##   Changed\n##   - Fixed Time platform to time_pattern platform\n##\n## 1.2.2 (2019-02-09)\n##   Added\n##   - Alert if battery state is unavailable\n##   Removed\n##   - Removed startup trigger from automation.update_battery_status_group_members\n##   Changed\n##   - Default to notify.notify if input_text.notifier_name doesn't contain \"notify.\"\n##\n## 1.2.3 (2019-03-02)\n##   Changed\n##   - Handle null attributes gracefully\n##\n## 1.2.4 (2019-03-02)\n##   Added\n##   - Added support for battery_critical attributes by @Djebouh\n##\n## 1.3.0 (2020-11-05) by @KptnKMan\n##   Info\n##   - Running successfully with HA 0.117.2\n##   Breaking Changes\n##   - Should be none, as far as I can tell.\n##   Fixed\n##   - Removed depreciated and defunct Group settings\n##   Removed\n##   - Persistent Notification of \"None (Unavailable)\" entities\n##   - Battery Status of \"None (Unavailable)\" entities\n##   - Battery Status Group no longer adds restored Unavailable entities\n##   - MQTT publish no longer adds restored Unavailable entities\n##   Added\n##   - Added Lovelace install instructions :)\n##\n################################################################\n################################################################\n\n################################################################\n## Install Instructions\n################################################################\n##\n##  1. Enable MQTT using your preferred MQTT broker\n##     https://home-assistant.io/components/mqtt/\n##\n##  2. Enable MQTT Discovery by adding `discovery: true` and\n##     `discovery_prefix: homeassistant` under the `mqtt:` section\n##     of your configuration.yaml\n##\n##     mqtt:\n##       discovery: true\n##       discovery_prefix: homeassistant\n##\n##  3. Save this file as CONFIGDIR/packages/battery_alert.yaml\n##\n##  4. Add `packages: !include_dir_named packages` under the\n##     `homeassistant:` section of your configuration.yaml\n##\n##     homeassistant:\n##       packages: !include_dir_named packages\n##\n##  5. Restart Home Assistant\n##\n##  6. Adjust Min Alert Threshold slider to the minimum battery\n##     level to alert on.  Note: the input slider requires the\n##     recorder component to keep it's state through restarts.\n##     If recorder is not enabled, the threshold can be set by\n##     un-remarking `initial` and setting the preferred default.\n##\n##  7. Adjust Max Alert Threshold slider to the maximum battery\n##     level to alert on.  Note: the input slider requires the\n##     recorder component to keep it's state through restarts.\n##     If recorder is not enabled, the threshold can be set by\n##     un-remarking `initial` and setting the preferred default.\n##\n##  8. Setup notifications by entering the notifier name in the `Notifier Name` input text box.\n##     E.g. `notify.slack`.  If no value is entered, it defaults to `notify.notify`.\n##\n##  9. Set the notifier format by selecting either `Default` or `Slack.  Note: most notifiers\n##     are compatible with the `Default` format.\n##\n## 10. To disable alerts for a specific entity, use customize to\n##     set `battery_alert_disabled` to `true`\n##\n##     homeassistant:\n##       customize:\n##         sensor.sensor_name_to_ignore_battery:\n##           battery_alert_disabled: true\n##\n## 11. To disable creating a sensor from battery attributes for a specific entity, use customize to\n##     set `battery_sensor_creation_disabled` to `true`\n##\n##     homeassistant:\n##       customize:\n##         sensor.sensor_with_battery_attibute:\n##           battery_sensor_creation_disabled: true\n##\n## 12. If a battery attribute requires a template to convert it into a usable percent, use customize\n##     to add `battery_template` with the necessary template. The template result must be a number\n##     that represents a percentage.\n##\n##     This example will create a battery sensor with the value of battery_level * 2\n##\n##     homeassistant:\n##       customize:\n##         sensor.sensor_with_battery_attibute_template:\n##           battery_template: \"{{ value_json.value | int * 2 }}\"\n##\n## 13. If a battery attribute requires a template to convert it into a string, use customize to add\n##     `battery_template_string` with the necessary template. The template result must be a string.\n##     For example, \"Low\" will trigger low battery notification).\n##\n##     This example will create a battery sensor that contains \"Low\" if battery_level\n##     is less than 2\n##\n##     homeassistant:\n##       customize:\n##         sensor.sensor_with_battery_attibute_template:\n##           battery_template_string: >-\n##             {%- if value_json.value < 2 -%}\n##             Low\n##             {%- else -%}\n##             Full\n##             {%- endif -%}\n################################################################\n\n################################################################\n## Lovelace Instructions - version 0.117+\n################################################################\n## \n## If you are using a recent version of Home Asssistant, and want to add the Battery Alert\n## to your Lovelace Dashboard, you should add the code snippet below to your Lovelace config.\n## \n## You can add this via the UI, select 'Edit Dashboard' -> 'Raw Configuration Editor'.\n## You can also add it directly to your 'lovelace.yaml' file.\n## \n## You should just be able to add this to the bottom, and be good to go :)\n## \n##  - title: Battery Alert\n##    path: battery-alert\n##    icon: 'mdi:battery-alert'\n##    badges: []\n##    cards:\n##      - type: entities\n##        entities:\n##          - entity: input_boolean.low_batteries\n##          - entity: input_number.battery_alert_threshold_min\n##          - entity: input_number.battery_alert_threshold_max\n##          - entity: input_text.delete_battery_sensor\n##          - entity: input_text.notifier_name\n##          - entity: input_select.notifier_format\n##          - entity: automation.battery_persistent_notification\n##          - entity: automation.battery_persistent_notification_clear\n##          - entity: automation.battery_notification_default\n##          - entity: automation.battery_notification_slack\n##          - entity: automation.battery_sensor_from_attributes\n##          - entity: automation.update_battery_status_group_members\n##          - entity: automation.delete_battery_sensor\n##        title: Battery Alert Main\n##        show_header_toggle: false\n##      - type: entities\n##        entities:\n##          - entity: group.battery_status\n##          - entity: group.battery_alert\n##          - entity: group.battery_view\n##        title: Battery Alert View\n##        show_header_toggle: false\n##\n################################################################\n################################################################\n\n################################################\n## Customize\n################################################\nhomeassistant:\n  customize:\n    ################################################\n    ## Node Anchors\n    ################################################\n    package.node_anchors:\n      customize: &customize\n        package: 'battery_alert'\n\n    ################################################\n    ## Group\n    ################################################\n    group.battery_view:\n      <<: *customize\n      friendly_name: \"Batteries\"\n      icon: mdi:battery-alert\n\n    group.battery_alert:\n      <<: *customize\n      friendly_name: \"Battery Alert\"\n      icon: mdi:steam\n\n    group.battery_status:\n      <<: *customize\n      friendly_name: \"Battery Status\"\n      icon: mdi:battery-charging\n\n    ################################################\n    ## Automation\n    ################################################\n    automation.battery_persistent_notification:\n      <<: *customize\n      friendly_name: \"Battery Persistent Notification\"\n      icon: mdi:comment-alert-outline\n\n    automation.battery_persistent_notification_clear:\n      <<: *customize\n      friendly_name: \"Battery Persistent Notification Clear\"\n      icon: mdi:comment-remove-outline\n\n    automation.battery_notification_default:\n      <<: *customize\n      friendly_name: \"Battery Notification Default Format\"\n      icon: mdi:comment-alert-outline\n\n    automation.battery_notification_slack:\n      <<: *customize\n      friendly_name: \"Battery Notification Slack Format\"\n      icon: mdi:comment-alert-outline\n\n    automation.battery_sensor_from_attributes:\n      <<: *customize\n      friendly_name: \"Create Battery Sensor from Attributes\"\n      icon: mdi:battery-charging-wireless-outline\n\n    automation.update_battery_status_group_members:\n      <<: *customize\n      friendly_name: \"Update Battery Status Group Members\"\n      icon: mdi:group\n\n    automation.delete_battery_sensor:\n      <<: *customize\n      friendly_name: \"Delete a Battery Sensor\"\n      icon: mdi:server-remove\n\n################################################\n## Group\n################################################\ngroup:\n  battery_view:\n    entities:\n      - group.battery_status\n      - group.battery_alert\n\n  battery_alert:\n    entities:\n      - input_boolean.low_batteries\n      - input_number.battery_alert_threshold_min\n      - input_number.battery_alert_threshold_max\n      - input_text.delete_battery_sensor\n      - input_text.notifier_name\n      - input_select.notifier_format\n      - automation.battery_persistent_notification\n      - automation.battery_persistent_notification_clear\n      - automation.battery_notification_default\n      - automation.battery_notification_slack\n      - automation.battery_sensor_from_attributes\n      - automation.update_battery_status_group_members\n      - automation.delete_battery_sensor\n\n################################################\n## Input Boolean\n################################################\ninput_boolean:\n  low_batteries:\n    name: Low Batteries\n    icon: mdi:battery-alert\n\n################################################\n## Input Number\n################################################\ninput_number:\n  battery_alert_threshold_max:\n    name: \"Max Alert Threshold\"\n    icon: mdi:arrow-collapse-up\n    mode: slider\n    min: -1\n    max: 100\n    # initial: 40\n\n  battery_alert_threshold_min:\n    name: \"Min Alert Threshold\"\n    icon: mdi:arrow-collapse-down\n    mode: slider\n    min: -1\n    max: 100\n    # initial: -1\n\n################################################\n## Input Select\n################################################\ninput_select:\n  notifier_format:\n    name: Notifier Format\n    options:\n     - Default\n     - Slack\n    icon: mdi:comment-question-outline\n\n################################################\n## Input Text\n################################################\ninput_text:\n  delete_battery_sensor:\n    name: Delete a Battery Sensor\n    mode: text\n    initial: ''\n\n  notifier_name:\n    name: Notifier Name\n    mode: text\n\n################################################\n## Automation\n################################################\nautomation:\n- alias: battery_persistent_notification\n  initial_state: 'on'\n  trigger:\n    - platform: time_pattern\n      minutes: '/15'\n      seconds: 00\n    - platform: state\n      entity_id:\n        - input_number.battery_alert_threshold_min\n        - input_number.battery_alert_threshold_max\n  action:\n    - condition: template\n      value_template: &low_battery_check >\n        {% macro battery_level() %}\n        {% for entity_id in states.group.battery_status.attributes.entity_id if (\n            not (\n                  is_state_attr(entity_id, 'battery_alert_disabled', true)\n                  or is_state_attr(entity_id, 'restored', true)\n                )\n          and states(entity_id) is not none\n          and (\n            (\n              (\n                states(entity_id) is number\n                or states(entity_id) | length == states(entity_id)| int | string | length\n                or states(entity_id) | length == states(entity_id)| float | string | length\n              )\n              and states(entity_id) | int < states.input_number.battery_alert_threshold_max.state | int\n              and states(entity_id) | int > states.input_number.battery_alert_threshold_min.state | int\n            )\n            or states(entity_id) | lower == 'low'\n            or states(entity_id) | lower == 'unknown'\n            or states(entity_id) | lower == 'unavailable'\n          )\n        ) -%}\n          {{ state_attr(entity_id, \"friendly_name\") }} ({{ states(entity_id) }})\n        {% endfor -%}\n        {% endmacro %}\n        {{ battery_level() | trim != \"\" }}\n    - service: input_boolean.turn_on\n      data:\n        entity_id: input_boolean.low_batteries\n    - service: persistent_notification.create\n      data_template:\n        title: \"Low Battery Levels\"\n        notification_id: low_battery_alert\n        message: &message >\n          {% macro battery_level() %}\n          {% for entity_id in states.group.battery_status.attributes.entity_id if (\n            not (\n                  is_state_attr(entity_id, 'battery_alert_disabled', true)\n                  or is_state_attr(entity_id, 'restored', true)\n                )\n            and states(entity_id) is not none\n            and (\n              (\n                (\n                  states(entity_id) is number\n                  or states(entity_id) | length == states(entity_id)| int | string | length\n                  or states(entity_id) | length == states(entity_id)| float | string | length\n                )\n                and states(entity_id) | int < states.input_number.battery_alert_threshold_max.state | int\n                and states(entity_id) | int > states.input_number.battery_alert_threshold_min.state | int\n              )\n              or states(entity_id) | lower == 'low'\n              or states(entity_id) | lower == 'unknown'\n              or states(entity_id) | lower == 'unavailable'\n            )\n          ) -%}\n            {{ state_attr(entity_id, \"friendly_name\") }} ({{ states(entity_id) }})\n          {% endfor -%}\n          {% endmacro %}\n          {{ battery_level() }}\n\n- alias: battery_persistent_notification_clear\n  initial_state: 'on'\n  trigger:\n    - platform: time_pattern\n      minutes: '/15'\n      seconds: 00\n    - platform: state\n      entity_id:\n        - input_number.battery_alert_threshold_min\n        - input_number.battery_alert_threshold_max\n  action:\n    - condition: template\n      value_template: &low_battery_clear >\n        {% macro battery_level() %}\n        {% for entity_id in states.group.battery_status.attributes.entity_id if (\n          not (\n                is_state_attr(entity_id, 'battery_alert_disabled', true)\n                or is_state_attr(entity_id, 'restored', true)\n              )\n          and states(entity_id) is not none\n          and (\n            (\n              (\n                states(entity_id) is number\n                or states(entity_id) | length == states(entity_id)| int | string | length\n                or states(entity_id) | length == states(entity_id)| float | string | length\n              )\n              and states(entity_id) | int < states.input_number.battery_alert_threshold_max.state | int\n              and states(entity_id) | int > states.input_number.battery_alert_threshold_min.state | int\n            )\n            or states(entity_id) | lower == 'low'\n            or states(entity_id) | lower == 'unknown'\n            or states(entity_id) | lower == 'unavailable'\n          )\n        ) -%}\n          {{ state_attr(entity_id, \"friendly_name\") }} ({{ states(entity_id) }})\n        {% endfor -%}\n        {% endmacro %}\n        {{ battery_level() | trim == \"\" }}\n    - service: input_boolean.turn_off\n      data:\n        entity_id: input_boolean.low_batteries\n    - service: persistent_notification.dismiss\n      data:\n        notification_id: low_battery_alert\n\n- alias: battery_notification_default\n  initial_state: 'on'\n  trigger:\n    - platform: time\n      at: '10:00:00'\n    - platform: time\n      at: '18:00:00'\n    - platform: state\n      entity_id:\n        - input_number.battery_alert_threshold_min\n        - input_number.battery_alert_threshold_max\n  action:\n    - condition: template\n      value_template: *low_battery_check\n    - condition: template\n      value_template: \"{{ states.input_select.notifier_format.state == 'Default' }}\"\n    - service_template: >\n        {% if \"notify.\" in states.input_text.notifier_name.state %}\n          {{ states.input_text.notifier_name.state }}\n        {% else %}\n          notify.notify\n        {% endif %}\n      data_template:\n        title: \"Low Battery Levels\"\n        message: *message\n\n- alias: battery_notification_slack\n  initial_state: 'on'\n  trigger:\n    - platform: time\n      at: '10:00:00'\n    - platform: time\n      at: '18:00:00'\n    - platform: state\n      entity_id:\n        - input_number.battery_alert_threshold_min\n        - input_number.battery_alert_threshold_max\n  action:\n    - condition: template\n      value_template: *low_battery_check\n    - condition: template\n      value_template: \"{{ states.input_select.notifier_format.state == 'Slack' }}\"\n    - service_template: >\n        {% if states.input_text.notifier_name.state != \"\" %}\n          {{ states.input_text.notifier_name.state }}\n        {% else %}\n          notify.notify\n        {% endif %}\n      data_template:\n        message: \"Low Battery Levels\"\n        data:\n          attachments:\n          - color: '#52c0f2'\n            title: \"These devices have low battery levels\"\n            text: *message\n\n- alias: battery_sensor_from_attributes\n  initial_state: 'on'\n  trigger:\n    - platform: event\n      event_type: state_changed\n  condition:\n    - condition: template\n      value_template: \"{{ trigger is not none }}\"\n    - condition: template\n      value_template: \"{{ trigger.event.data is not none }}\"\n    - condition: template\n      value_template: \"{{ trigger.event.data.old_state is not none }}\"\n    - condition: template\n      value_template: \"{{ trigger.event.data.new_state is not none }}\"\n    - condition: template\n      value_template: \"{{ 'battery' not in trigger.event.data.new_state.name | lower }}\"\n    - condition: template\n      value_template: \"{{ not is_state_attr(trigger.event.data.entity_id, 'device_class', 'battery') }}\"\n    - condition: template\n      value_template: \"{{ not is_state_attr(trigger.event.data.entity_id, 'battery_sensor_creation_disabled', true) }}\"\n    - condition: template\n      value_template: \"{{ not is_state_attr(trigger.event.data.entity_id, 'restored', true) }}\"\n    - condition: or\n      conditions:\n        - condition: and\n          conditions:\n            - condition: template\n              value_template: \"{{ trigger.event.data.new_state.attributes.battery_level is defined }}\"\n            - condition: template\n              value_template: \"{{ trigger.event.data.new_state.attributes.battery_level is not none }}\"\n        - condition: and\n          conditions:\n            - condition: template\n              value_template: \"{{ trigger.event.data.new_state.attributes.battery is defined }}\"\n            - condition: template\n              value_template: \"{{ trigger.event.data.new_state.attributes.battery is not none }}\"\n        - condition: and\n          conditions:\n            - condition: template\n              value_template: \"{{ trigger.event.data.new_state.attributes['Battery numeric'] is defined }}\"\n            - condition: template\n              value_template: \"{{ trigger.event.data.new_state.attributes['Battery numeric'] is not none }}\"\n        - condition: and\n          conditions:\n            - condition: template\n              value_template: \"{{ trigger.event.data.new_state.attributes.battery_critical is defined }}\"\n            - condition: template\n              value_template: \"{{ trigger.event.data.new_state.attributes.battery_critical is not none }}\"\n  action:\n    - service: mqtt.publish\n      data_template:\n        topic: \"homeassistant/sensor/{{ trigger.event.data.entity_id.split('.')[1] }}_battery/config\"\n        retain: true\n        payload: &config_payload >-\n          {\n            {% if trigger.event.data.new_state.attributes.battery_level is defined -%}\n              {%- set attribval = trigger.event.data.new_state.attributes.battery_level -%}\n              {%- set attribname = 'battery_level' -%}\n            {%- elif trigger.event.data.new_state.attributes.battery is defined -%}\n              {%- set attribval = trigger.event.data.new_state.attributes.battery -%}\n              {%- set attribname = 'battery' -%}\n            {%- elif trigger.event.data.new_state.attributes['Battery numeric'] is defined -%}\n              {%- set attribval = (trigger.event.data.new_state.attributes['Battery numeric'] | int + 1) * 10 -%}\n              {%- set attribname = 'Battery numeric' -%}\n            {% elif trigger.event.data.new_state.attributes.battery_critical is defined -%}\n              {%- set attribval = trigger.event.data.new_state.attributes.battery_critical -%}\n              {%- set attribname = 'battery_critical' -%}\n            {%- endif -%}\n            \"name\": \"{{ trigger.event.data.new_state.name }} Battery\",\n            \"state_topic\": \"homeassistant/sensor/{{ trigger.event.data.entity_id.split('.')[1] }}_battery/state\",\n            {% if trigger.event.data.new_state.attributes.battery_template is defined -%}\n            \"value_template\": \"{{ trigger.event.data.new_state.attributes.battery_template }}\",\n            \"unit_of_measurement\": \"%\",\n            \"device_class\": \"battery\",\n            {% elif trigger.event.data.new_state.attributes.battery_template_string is defined -%}\n            \"value_template\": \"{{ trigger.event.data.new_state.attributes.battery_template_string }}\",\n            \"icon\": \"mdi:battery\",\n            {% elif trigger.event.data.new_state.attributes.battery_critical is defined -%}\n            \"value_template\": \"{{ \"{{\" }} 'low' if value_json.value else 'full' {{ \"}}\" }}\",\n            \"icon\": \"mdi:battery\",\n            {% else -%}\n            \"value_template\": \"{{ \"{{\" }} value_json.value | int {{ \"}}\" }}\",\n            {% if attribval | int == attribval or attribval | float == attribval or attribval | length == attribval | float | string | length or attribval | length == attribval | int | string | length -%}\n            \"unit_of_measurement\": \"%\",\n            \"device_class\": \"battery\",\n            {%- elif attribval == \"High\" or attribval == \"Full\" -%}\n            \"icon\": \"mdi:battery\",\n            {%- elif attribval == \"Medium\" or attribval == \"Med\"-%}\n            \"icon\": \"mdi:battery-50\",\n            {%- elif attribval == \"Low\" -%}\n            \"icon\": \"mdi:battery-alert\",\n            {%- else -%}\n            \"icon\": \"mdi:battery-unknown\",\n            {%- endif %}\n            {% endif -%}\n            \"unique_id\": \"{{ trigger.event.data.entity_id.split('.')[1] }}_battery\",\n            \"json_attributes_topic\": \"homeassistant/sensor/{{ trigger.event.data.entity_id.split('.')[1] }}_battery/attributes\"\n          }\n    - service: mqtt.publish\n      data_template:\n        topic: \"homeassistant/sensor/{{ trigger.event.data.entity_id.split('.')[1] }}_battery/state\"\n        retain: true\n        payload: >-\n          {\n            {% if trigger.event.data.new_state.attributes.battery_level is defined -%}\n              {%- set attribval = trigger.event.data.new_state.attributes.battery_level -%}\n            {%- elif trigger.event.data.new_state.attributes.battery is defined -%}\n              {%- set attribval = trigger.event.data.new_state.attributes.battery -%}\n            {%- elif trigger.event.data.new_state.attributes['Battery numeric'] is defined -%}\n              {%- set attribval = (trigger.event.data.new_state.attributes['Battery numeric'] | int + 1) * 10 -%}\n            {%- elif trigger.event.data.new_state.attributes.battery_critical is defined -%}\n              {%- set attribval = trigger.event.data.new_state.attributes.battery_critical -%}\n            {%- endif -%}\n            \"value\": {% if attribval | int == attribval -%}\n              {{ attribval | int }}\n            {%- elif attribval | float == attribval -%}\n              {{ attribval | float }}\n            {%- elif attribval | length == attribval | float | string | length -%}\n              {{ attribval | float }}\n            {%- elif attribval | length == attribval | int | string | length -%}\n              {{ attribval | int }}\n            {%- else -%}\n              \"{{ attribval }}\"\n            {%- endif %}\n          }\n    - service: mqtt.publish\n      data_template:\n        topic: \"homeassistant/sensor/{{ trigger.event.data.entity_id.split('.')[1] }}_battery/attributes\"\n        retain: true\n        payload: >-\n          {\n            {% if trigger.event.data.new_state.attributes.battery_level is defined -%}\n              {%- set attribval = trigger.event.data.new_state.attributes.battery_level -%}\n              {%- set attribname = 'battery_level' -%}\n            {%- elif trigger.event.data.new_state.attributes.battery is defined -%}\n              {%- set attribval = trigger.event.data.new_state.attributes.battery -%}\n              {%- set attribname = 'battery' -%}\n            {%- elif trigger.event.data.new_state.attributes['Battery numeric'] is defined -%}\n              {%- set attribval = (trigger.event.data.new_state.attributes['Battery numeric'] | int + 1) * 10 -%}\n              {%- set attribname = 'Battery numeric' -%}\n            {%- elif trigger.event.data.new_state.attributes.battery_critical is defined -%}\n              {%- set attribval = trigger.event.data.new_state.attributes.battery_critical -%}\n              {%- set attribname = 'battery_critical' -%}\n            {%- endif -%}\n            \"entity_id\": \"{{ trigger.event.data.entity_id }}\",\n            {% if attribname is defined -%}\n            \"{{ attribname }}\": \"{{ attribval }}\",\n            {%- endif %}\n            \"delete_battery_sensor\": \"homeassistant/sensor/{{ trigger.event.data.entity_id.split('.')[1] }}_battery\"\n          }\n\n- alias: update_battery_status_group_members\n  initial_state: 'on'\n  trigger:\n    - platform: time_pattern\n      minutes: '/1'\n      seconds: 00\n  action:\n    - service: group.set\n      data_template:\n        object_id: \"battery_status\"\n        entities: >-\n          {%- for item in states.sensor if (\n            not is_state_attr(item.entity_id, 'hidden', true)\n            and (\n              is_state_attr(item.entity_id, 'device_class', 'battery')\n              or 'battery' in item.attributes.icon | lower\n              or (item.entity_id | lower).endswith('_bat')\n              or (item.name | lower).endswith('_bat')\n              ) or (\n                (\n                  'battery' in item.entity_id | lower\n                  or 'battery' in item.name | lower\n                ) and (\n                  item.attributes.icon is not defined\n                ) and (\n                  not is_state_attr(item.entity_id, 'battery_alert_disabled', true)\n                ) and (\n                  not is_state_attr(item.entity_id, 'restored', true)\n                )\n              )\n            )\n          -%}\n            {{ item.entity_id }}{% if not loop.last %}, {% endif %}\n          {%- endfor -%}\n\n- alias: delete_battery_sensor\n  initial_state: 'on'\n  trigger:\n    - platform: state\n      entity_id:\n        - input_text.delete_battery_sensor\n  condition:\n    - condition: template\n      value_template: \"{{ 'homeassistant/sensor/' in states.input_text.delete_battery_sensor.state }}\"\n  action:\n    - service: mqtt.publish\n      data_template:\n        topic: \"{{ states.input_text.delete_battery_sensor.state }}\"\n        retain: true\n    - service: mqtt.publish\n      data_template:\n        topic: \"{{ states.input_text.delete_battery_sensor.state }}/attributes\"\n        retain: true\n    - service: mqtt.publish\n      data_template:\n        topic: \"{{ states.input_text.delete_battery_sensor.state }}/state\"\n        retain: true\n    - service: mqtt.publish\n      data_template:\n        topic: \"{{ states.input_text.delete_battery_sensor.state }}/config\"\n        retain: true\n"
  },
  {
    "path": "sensors.yaml",
    "content": ""
  },
  {
    "path": "switches.yaml",
    "content": ""
  },
  {
    "path": "travis_secrets.yaml",
    "content": "http_api_password: password\r\nhome_latitude: 000.0000000\r\nhome_longitude: 000.0000000\r\nhome_elevation: 00\r\nhome_timezone: America/New_York\r\ntrusted_ip: 10.0.0.0/8\r\nha_ip: 127.0.0.1\r\nmqtt_broker_ip: 127.0.0.1\r\nmqtt_port: 1883\r\nmqtt_username: username\r\nmqtt_password: password\r\nmqtt_client_id: hass-1\r\n"
  },
  {
    "path": "zones.yaml",
    "content": ""
  }
]