master b7a95a3c40ee cached
67 files
283.3 KB
77.0k tokens
1 requests
Download .txt
Showing preview only (301K chars total). Download the full file or copy to clipboard to get everything.
Repository: CiquattroFPV/Homeassistant-Example-Config
Branch: master
Commit: b7a95a3c40ee
Files: 67
Total size: 283.3 KB

Directory structure:
gitextract_3yxyy90d/

├── .gitignore
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── PULL_REQUEST_TEMPLATE.md
├── README.md
├── alarm.yaml
├── announcements.yaml
├── automations.yaml
├── camera.yaml
├── configuration.yaml
├── cover.yaml
├── customize.yaml
├── device_tracker.yaml
├── google.yaml
├── groups.yaml
├── input_boolean/
│   └── trigger_booleans.yaml
├── input_select/
│   ├── ac_mode.yaml
│   ├── living_bright.yaml
│   ├── living_scene.yaml
│   ├── log_level.yaml
│   ├── lounge_scene.yaml
│   ├── nico_room_scene.yaml
│   ├── pc_power_options.yaml
│   └── who_cook.yaml
├── input_slider/
│   └── living_bright.yaml
├── ip_bans.yaml
├── light.yaml
├── media_player.yaml
├── mqtt.yaml
├── notify.yaml
├── panel_custom.yaml
├── scene/
│   ├── TV_Time.yaml
│   ├── TV_Time_off.yaml
│   ├── living.yaml
│   ├── living_lights_off.yaml
│   ├── living_lights_on.yaml
│   ├── monthly_colors.yaml
│   ├── movies.yaml
│   ├── my_room.yaml
│   ├── romantic.yaml
│   └── romatic_my.yaml
├── scripts/
│   ├── low_battery.yaml
│   ├── monthly_color_scene.yaml
│   ├── refresh_devices.yaml
│   ├── restart_ha.yaml
│   ├── scene_notify.yaml
│   ├── sunrise.yaml
│   ├── sunset.yaml
│   └── voice_notify.yaml
├── scripts.yaml
├── sensor.yaml
├── switch.yaml
├── themes/
│   ├── amoled.yaml
│   ├── another-dark.yaml
│   ├── binary_sensors.yaml
│   ├── darkblue.yaml
│   ├── darkcyan.yaml
│   ├── darkorange.yaml
│   ├── darkred.yaml
│   ├── grey-night.yaml
│   ├── grey_night.yaml
│   ├── material_dark_green.yaml
│   ├── material_dark_pink.yaml
│   ├── midnight.yaml
│   └── slate.yaml
└── ui-lovelace.yaml

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
.uuid

================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Code of Conduct

## 1. Purpose

A primary goal of Homeassistant Example Config is to be inclusive to the largest number of contributors, with the most varied and diverse backgrounds possible. As such, we are committed to providing a friendly, safe and welcoming environment for all, regardless of gender, sexual orientation, ability, ethnicity, socioeconomic status, and religion (or lack thereof).

This code of conduct outlines our expectations for all those who participate in our community, as well as the consequences for unacceptable behavior.

We invite all those who participate in Homeassistant Example Config to help us create safe and positive experiences for everyone.

## 2. Open Source Citizenship

A supplemental goal of this Code of Conduct is to increase open source citizenship by encouraging participants to recognize and strengthen the relationships between our actions and their effects on our community.

Communities mirror the societies in which they exist and positive action is essential to counteract the many forms of inequality and abuses of power that exist in society.

If you see someone who is making an extra effort to ensure our community is welcoming, friendly, and encourages all participants to contribute to the fullest extent, we want to know.

## 3. Expected Behavior

The following behaviors are expected and requested of all community members:

*   Participate in an authentic and active way. In doing so, you contribute to the health and longevity of this community.
*   Exercise consideration and respect in your speech and actions.
*   Attempt collaboration before conflict.
*   Refrain from demeaning, discriminatory, or harassing behavior and speech.
*   Be mindful of your surroundings and of your fellow participants. Alert community leaders if you notice a dangerous situation, someone in distress, or violations of this Code of Conduct, even if they seem inconsequential.
*   Remember that community event venues may be shared with members of the public; please be respectful to all patrons of these locations.

## 4. Unacceptable Behavior

The following behaviors are considered harassment and are unacceptable within our community:

*   Violence, threats of violence or violent language directed against another person.
*   Sexist, racist, homophobic, transphobic, ableist or otherwise discriminatory jokes and language.
*   Posting or displaying sexually explicit or violent material.
*   Posting or threatening to post other people’s personally identifying information ("doxing").
*   Personal insults, particularly those related to gender, sexual orientation, race, religion, or disability.
*   Inappropriate photography or recording.
*   Inappropriate physical contact. You should have someone’s consent before touching them.
*   Unwelcome sexual attention. This includes, sexualized comments or jokes; inappropriate touching, groping, and unwelcomed sexual advances.
*   Deliberate intimidation, stalking or following (online or in person).
*   Advocating for, or encouraging, any of the above behavior.
*   Sustained disruption of community events, including talks and presentations.

## 5. Consequences of Unacceptable Behavior

Unacceptable behavior from any community member, including sponsors and those with decision-making authority, will not be tolerated.

Anyone asked to stop unacceptable behavior is expected to comply immediately.

If a community member engages in unacceptable behavior, the community organizers may take any action they deem appropriate, up to and including a temporary ban or permanent expulsion from the community without warning (and without refund in the case of a paid event).

## 6. Reporting Guidelines

If you are subject to or witness unacceptable behavior, or have any other concerns, please notify a community organizer as soon as possible. .



Additionally, community organizers are available to help community members engage with local law enforcement or to otherwise help those experiencing unacceptable behavior feel safe. In the context of in-person events, organizers will also provide escorts as desired by the person experiencing distress.

## 7. Addressing Grievances

If you feel you have been falsely or unfairly accused of violating this Code of Conduct, you should notify Ciquattro Fpv with a concise description of your grievance. Your grievance will be handled in accordance with our existing governing policies.



## 8. Scope

We expect all community participants (contributors, paid or otherwise; sponsors; and other guests) to abide by this Code of Conduct in all community venues–online and in-person–as well as in all one-on-one communications pertaining to community business.

This code of conduct and its related procedures also applies to unacceptable behavior occurring outside the scope of community activities when such behavior has the potential to adversely affect the safety and well-being of community members.

## 9. Contact info



## 10. License and attribution

This Code of Conduct is distributed under a [Creative Commons Attribution-ShareAlike license](http://creativecommons.org/licenses/by-sa/3.0/).

Portions of text derived from the [Django Code of Conduct](https://www.djangoproject.com/conduct/) and the [Geek Feminism Anti-Harassment Policy](http://geekfeminism.wikia.com/wiki/Conference_anti-harassment/Policy).

Retrieved on November 22, 2016 from [http://citizencodeofconduct.org/](http://citizencodeofconduct.org/)


================================================
FILE: CONTRIBUTING.md
================================================
---
layout: page
title: "Contributor License Agreement"
description: "The Code of Conduct for Home Assistant projects."
date: 2017-01-21 15:05:00 -0800
sidebar: true
comments: false
sharing: true
footer: true
---

# Contributor License Agreement

```
By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the Apache 2.0 license; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the Apache 2.0 license; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it) is maintained indefinitely
    and may be redistributed consistent with this project or the open
    source license(s) involved.
```

## Attribution

The text of this license is available under the [Creative Commons Attribution-ShareAlike 3.0 Unported License](http://creativecommons.org/licenses/by-sa/3.0/).  It is based on the Linux [Developer Certificate Of Origin](http://elinux.org/Developer_Certificate_Of_Origin), but is modified to explicitly use the Apache 2.0 license
and not mention sign-off.

## Signing

If you have not signed the CLA and you submit a pull request to a repository under the Home Assistant organization, a link will be automatically generated. Just follow the link and the instructions in the link.

## Adoption

This Contributor License Agreement (CLA) was first announced on January 21st, 2017 in [this][cla-blog] blog post and adopted January 28th, 2017.

[cla-blog]: /blog/2017/01/21/home-assistant-governance/


================================================
FILE: LICENSE
================================================
                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright [yyyy] [name of copyright owner]

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.


================================================
FILE: PULL_REQUEST_TEMPLATE.md
================================================
Submit your work

Submit your improvements, fixes, and new features to Homeassistant-Example-Config one at a time, using GitHub Pull Requests. Here are the steps:

    From your fork's dev branch, create a new branch to hold your changes:

    git checkout -b some-feature

    Make your changes, create a new platform, develop a new component, or fix issues.

    Test your changes and check for style violations.

    If everything looks good according to these musts, commit your changes:

    git add .

    git commit -m "Added some-feature"
        Write a meaningful commit message and not only Update or Fix.
        Use a capital letter to start with your commit message.
        Don't prefix your commit message with [bla.bla] or platform:.
        Consider adding tests to ensure that your code works.

    Push your committed changes back to your fork on GitHub:

    git push origin HEAD

    Follow these steps to create your pull request.
        On GitHub, navigate to the main page of the Home Assistant repository.
        In the "Branch" menu, choose the branch that contains your commits (from your fork).
        To the right of the Branch menu, click New pull request.
        Use the base branch dropdown menu to select the branch you'd like to merge your changes into, then use the compare branch drop-down menu to choose the topic branch you made your changes in. Make sure the Home Assistant branch matches with your forked branch (dev) else you will propose ALL commits between branches.
        Type a title and complete the provided description for your pull request.
        Click Create pull request.

    Check for comments and suggestions on your pull request and keep an eye on the CI output.



================================================
FILE: README.md
================================================
# Homeassistant Template Example By Nicolò Steffè

Home assistant Configuration (YAMLs)

This is my Home Assistant Configuration created with Raspberry Pi3 with Hassio.

- Alexa voice command integrated with haaska https://github.com/mike-grant/haaska/wiki
- Android Devices (iPads, iPods, iPhones)
- Owntracks for presence detection and GPS logging
![alt text](screenshots/hass02.png "Screenshot Example")

- Mitsubishi Air Conditioner and Belkin IR Blaster - Mini R3

.   ![alt text](screenshots/ir02.png "Player View")
.   ![alt text](screenshots/ir01.png "Player View")

- Sony Bravia Android TV and Chromecast TV 


.   ![alt text](screenshots/player01.png "Media Player View")

- Alexa Media Player
![alt text](screenshots/alexa01.png "Alexa Media players")

- Fritbox and Presence detection

- Synology NAS
- Reolink E1 Pro
![alt text](screenshots/cam01.png "Camera View")

- Shelly Devices

![alt text](screenshots/shelly01.png "Lights View")
![alt text](screenshots/shelly02.png "Lights View")

- Yeelight RGB and White Bulb and Hass Scenes
![alt text](screenshots/lights01.png "Lights View")

- Efergy for Energy cost monitor
![alt text](screenshots/energy01.png "Efergy Example")
![alt text](screenshots/efergy01.png "Efergy Example")
![alt text](screenshots/efergy02.png "Efergy Example")

- Telegram Notification
- FitBit Integration

![alt text](screenshots/fitbit01.png "Fitbit Example")

- Active Weather Map and International Space Station Integration
![alt text](screenshots/hass02.png "Screenshot Example")

- View Example
![alt text](screenshots/hass01.png "Screenshot Example")



================================================
FILE: alarm.yaml
================================================
platform: manual
name: House
pending_time: 30
trigger_time: 600

================================================
FILE: announcements.yaml
================================================
  #alias: 'People Greeting'
  #trigger:
    #- platform: state
      #entity_id:
        #- device_tracker.my_my
        #- device_tracker.person_person
        #- device_tracker.iphonemarie
      #from: 'not_home'
      #to: 'home'
      #for: '00:02:00'
  #action:
    #- service: script.Voice_notify
      #data_template:
        #value1: >
          #{% set person = trigger.entity_id.split('.')[1]|replace('_', ' ')%}
          #{%- macro greeting_sentence(person) -%}
          #{{ [
          #"Welcome home " ~ person,
          #"Guess who is home? "  ~ person +" is!",
          #"Attention: " ~ person + " is now in the house.",
          #"Welcome Home " ~ person + ".  We've missed you. or at least Molly did.",
          #"Our home is now complete, Rest your head and relax your feet! Welcome Back " ~ person,
          #"Life is like a song, you’re back where you belong. Welcome home " ~ person,
          #"Hey there " ~ person + " Welcome Home!",
          #person ~ "! You're home!"
          #] | random }}
          #{%- endmacro -%}
          #"{{greeting_sentence(person)}}"

================================================
FILE: automations.yaml
================================================
# - id: letsencrypt-renewal-30d-before-expiry
#   alias: Let's Encrypt Renewal at 15 Days before expiration
#   initial_state: 'on'
#   trigger:
#   - platform: numeric_state
#     entity_id: sensor.ssl_certificate_expiry
#     below: 15
#     for:
#       minutes: 20
#   action:
#   - service: notify.hassnico_bot
#     data_template:
#       message: '"Let's Encrypt CA must be Renewed. Expiry date is at 30 Days from
#         now"'
#   - service: hassio.addon_restart
#     data:
#       addon: core_letsencrypt
#   - service: notify.hassnico_bot
#     data_template:
#       message: '"Let's Encrypt CA was Renewed"'
#   - delay: 00:10:00
#   - service: script.restart_ha
#   - service: notify.hassnico_bot
#     data:
#       message: HA - Restart - Triggered - After CA Renew

- alias: Coffe Greetings - Notification 
  id: coffe-greetings-notify
  initial_state: 'on'
  trigger:
    # platform: template
    # value_template: "{{ state_attr('sensor.shelly_shplg_s_04169c_current_consumption', 'consumption')|int > 1000 }}"
    platform: numeric_state
    entity_id: sensor.shelly_shplg_s_04169c_current_consumption
    above: 1000
    for:
      seconds: 6
  action:
  - service: notify.hassnico_bot
    data:
      message: Qualcuno sta facendo il Caffè
  # - service: media_player.volume_set
  #   data:
  #     entity_id: media_player.nico_bose_home
  #     volume_level: 0.25
  - delay: 00:00:20
  #- service: script.cucinacoffe
  - service: script.cast_on_kitchen
  - service: notify.alexa_media
    data:
      target:
      # - media_player.nico_bose_home
      - media_player.nicolo_s_2nd_bose_home_speaker_500
      data:
        type: tts
      message: >
        {{ [ 
         "Spero che il Caffè sia buono",
         "Spero che il Caffè sia di tuo gradimento",
         "Nespresso o Borbone, questo è il problema!",
         "Oh che bello caffè",
         "Ci vuole proprio una bella pausa caffè",
         "Non c’è niente di meglio di una tazza di caffè",
         "All you need is Coffee",
        ] | random }}


- id: scene-washing-machine-working-notify
  alias: Washing Machine is Working - Notification
  initial_state: 'on'
  trigger:
    # platform: template
    # value_template: "{{ state_attr('sensor.shelly_shplg_s_5b2502_current_consumption', 'consumption')|int > 200 }}"
    platform: numeric_state
    entity_id: sensor.shelly_shplg_s_5b2502_current_consumption
    above: 250
    for:
      seconds: 6
  action:
  - service: input_select.select_option
    data:
      entity_id: input_select.washing_machine_state
      option: Working


- id: scene-washing-machine-working
  alias: Washing Machine is Working - Notification
  trigger:
    platform: state
    entity_id: input_select.washing_machine_state
    to: Working
  action:
  - service: notify.hassnico_bot
    data_template:
      message: 'Washing Machine is : {{ trigger.to_state.state }}'
  - service: notify.hassnico_bot
    data:
      message: La Lavatrice è in Funzione
  - service: notify.alexa_media
    data:
      target:
      # - media_player.nico_bose_home
      - media_player.nicolo_s_2nd_bose_home_speaker_500
      data:
        type: tts
      message: >
        {{ [ 
        "La Lavatrice è in funzione, Ricordati di verificare se ci sono altri elettrodomestici accesi",
        "Si avverte la gentile clientela che la lavatrice è iniziata, si prega di verificare che altri elettrodomestici ad alto consumo non siano attivi",
        "La Lavatrice è in funzione, verifica anche se ci sono altri elettrodomestici in funzione",
        "Era proprio l'ora di fare la lavatrice, ti volevo ricordare di fare un controllo se anche altri elettrodomestici sono attivi.",
        ] | random }}
  - service: script.cast_on_kitchen

- id: scene-washing-machine-off-notify
  alias: Washing Machine Scene Power Off - Notification
  initial_state: 'on'
  trigger:
    # platform: template
    # value_template: "{{ state_attr('sensor.shelly_shplg_s_5b2502_current_consumption', 'consumption')|int < 25 }}"
    platform: numeric_state
    entity_id: sensor.shelly_shplg_s_5b2502_current_consumption
    below: 26
    for:
      minutes: 1
      seconds: 10
  action:
  - service: input_select.select_option
    data:
      entity_id: input_select.washing_machine_state
      option: Power Off

- id: scene-washing-machine-poweroff
  alias: Washing Machine Power off- Notification
  trigger:
    platform: state
    entity_id: input_select.washing_machine_state
    to: Power Off
  action:
  - service: notify.hassnico_bot
    data_template:
      message: 'Washing Machine is : {{ trigger.to_state.state }}'
  - service: notify.hassnico_bot
    data:
      message: La Lavatrice è finita
  - service: notify.alexa_media
    data:
      target:
      # - media_player.nico_bose_home
      - media_player.nicolo_s_2nd_bose_home_speaker_500
      data:
        type: tts
      message: >
        '{{ [ 
        "La Lavatrice è finita, ora bisogna stendere i panni",
        "La lavatrice ha terminato il lavaggio",
        "La lavatrice è finita, chi stende i panni?",
        "I panni li stende Nico o li stende Maria? Questo è il problema",
        ] | random }}'
  - service: script.cast_on_kitchen

- alias: Energy Alarm - Notification
  id: 12181a719f5f4473916149f7ce20502b
  initial_state: 'on'
  trigger:
    # platform: template
    # value_template: "{{ state_attr('sensor.shelly_shem_b9ee2d_1_current_consumption', 'consumption')|int > 100 }}"
    platform: numeric_state
    entity_id: sensor.shelly_shem_b9ee2d_1_current_consumption
    above: 3200
    for:       
      minutes: 10
    # below: 25
  action:
  - service: notify.hassnico_bot
    data:
      message: Sta per scattare la corrente a casa
  - service: media_player.volume_set
    data:
      entity_id: media_player.nico_bose_home
      volume_level: 0.35
  - service: notify.alexa_media
    data:
      target:
      - media_player.nico_bose_home
      data:
        type: tts
      message: >
         '{{ [ 
         "Il consumo energetico sta per superare il limite consentito, verificare se sono accesi troppi elettrodomestici prima che scatti la corrente perfavore",
         "Perfavore controllate i consumi energetici, si sta superando la soglia consentita, potrebbe scattare la corrente",
         "Sta per scattare la corrente, perfavore controllare i dispositivi accesi in casa",
         ] | random }}'

- alias: Nico is Driving - Notification
  initial_state: 'on'
  trigger:
    platform: template
    value_template: "{{ state_attr('device_tracker.sm_g950f', 'velocity')|int >= 50 }}"
    for:
      seconds: 20
  action:
  - service: notify.hassnico_bot
    data:
      message: Nico is Driving
  - service: script.alexatraffic2
  id: f5d2b6ae95cc4cb893b890b3ff4cc0ce

- id: light-self-shutdown
  alias: Lights Self Shutdown
  initial_state: 'on'
  trigger:
  - platform: state
    entity_id:
    - switch.shelly_shsw_25_687269_1
    - switch.shelly_shsw_25_687269_2
    to: 'on'
    for: 00:30:00
  - platform: state
    entity_id:
    - switch.shelly_shsw_25_e5e601_1
    - switch.shelly_shsw_25_e5e601_2
    to: 'on'
    for: 01:15:00
  - platform: state
    entity_id:
    - switch.shelly_shsw_25_686d62_1
    - switch.shelly_shsw_25_686d62_2
    - switch.shelly_shsw_25_68796e_1
    - light.shelly_shsw_25_68796e_1
    - switch.shelly_shsw_25_68796e_2
    - light.shelly_shsw_25_68796e_2
    to: 'on'
    for: 02:00:00
  action:
  - service: switch.turn_off
    data_template:
      entity_id: '{{ trigger.entity_id }}'
  - service: notify.hassnico_bot
    data_template:
      message: '"{{ trigger.to_state.attributes.friendly_name }} just changed from
        {{ trigger.to_state.state }} to {{ trigger.from_state.state }}. Self Shutdown!"'
  # - service: media_player.volume_set
  #   data:
  #     entity_id: media_player.nico_bose_home
  #     volume_level: 0.3
  - service: notify.alexa_media
    data:
      target:
      - media_player.nicolo_s_2nd_bose_home_speaker_500
      data:
        type: tts
      message: >
        '{{ [
        "La Luce si è spenta automaticamente",
        "Risparmio Energetico Attivato da Home Assistant, la luce si è spenta",
        "La luce si è spenta",        
        ] | random }}'

- id: camera-self-turn_on
  alias: Video Camera Self Turn On
  initial_state: 'on'
  trigger:
  - platform: state
    entity_id:
    - switch.ciabatta_rack_fritz_dect_200_1
    to: 'off'
    for: 00:45:00
  action:
  - service: switch.turn_on
    data_template:
      entity_id: '{{ trigger.entity_id }}'
  - service: notify.hassnico_bot
    data_template:
      message: '"{{ trigger.to_state.attributes.friendly_name }} just changed from
        {{ trigger.to_state.state }} to {{ trigger.from_state.state }}. Self Turn on!"'


- id: midnight-routine-shutdown
  alias: Turn off Light and Nesthub at Midnight
  initial_state: 'on'
  trigger:
    platform: time
    at: '23:59:00'
  action:
    - service: homeassistant.turn_off
      entity_id: group.lights
    - service: media_player.turn_off
      entity_id: media_player.cucina

- id: light-on-at-entrance-after-sunset
  alias: Turn on Light After Sunset - All Days - when Family group at Home
  initial_state: 'on'
  trigger:
  - platform: state
    entity_id: group.family
    to: home
  condition:
    condition: or
    conditions:
    - condition: sun
      after: sunset
    - condition: sun
      before: sunrise
  action:
  - service: switch.turn_on
    entity_id: switch.shelly_shsw_25_68796e_1  #luci salone 1
  - service: switch.turn_on
    entity_id: switch.shelly_shsw_25_68796e_2 #luci cucina 2
  - service: notify.alexa_media
    data:
      target:
      - media_player.nicolo_s_2nd_bose_home_speaker_500
      data:
        type: tts
      message: >
        '{{ [ 
        "Luci di benvenuto attivate",
        "Luci di benvenuto attive",
        "Luci di cortesia attive",
        ] | random }}'
  - service: notify.hassnico_bot
    data_template:
      message: '"Qualcuno è tornato/a a casa e sono state accese le luci di benvenuto"'

- id: light-on-sunset
  alias: Light on Sunset
  initial_state: 'on'
  trigger:
    platform: sun
    event: sunset
    offset: "-00:59:00"
  condition:
    condition: state
    entity_id: group.family
    state: 'home'
  action:
  - service: homeassistant.turn_on
    entity_id: switch.shelly_shsw_25_686d62_2
  - service: notify.hassnico_bot
    data:
      message: Sunset - Lights ON at {{ states('sensor.date_time') }}
  # - service: media_player.volume_set
  #   data:
  #     entity_id: media_player.nico_bose_home
  #     volume_level: 0.3
  - delay: 00:00:02
  - service: notify.alexa_media
    data:
      target:
      - media_player.nicolo_s_2nd_bose_home_speaker_500
      data:
        type: tts
      message: >
       '{{ [
       "Le luci sono state accese al tramonto",
       "Casa era poco illuminata ed ho pensato di accendere le luci",
       "Le luci sono state accese perchè era poco illuminato",
        ] | random }}'

- id: notify-update
  alias: Update Available Notifications
  initial_state: 'on'
  trigger:
  - platform: state
    entity_id: binary_sensor.updater
    from: 'off'
    to: 'on'
  action:
    service: notify.hassnico_bot
    data:
      message: Home Assistant {{ state_attr('binary_sensor.updater', 'newest_version') }} is available.

- id: bad-logins
  alias: Login Failure
  initial_state: 'on'
  trigger:
    platform: template
    value_template: "{{ states('persistent_notification.httplogin') != 'authentication' }}"
  action:
    service: notify.hassnico_bot
    data:
      message: Bad Login.. There was a Hack attempt! Go Check the GUI for details.

- id: notify-today-chef
  alias: Who Cook
  initial_state: 'on'
  trigger:
    platform: state
    entity_id: input_select.who_cooks
  action:
  - service: notify.hassnico_bot
    data_template:
      message: "Today Cook {{ trigger.to_state.state }}"

- id: notify-nico-battery-low
  alias: Nico Battery Low - Notification
  initial_state: 'on'
  trigger:
  - platform: numeric_state
    entity_id:
    - sensor.batteria_telefono_nico
    above: 0
    below: 36
  action:
  - service: notify.hassnico_bot
    data:
      message: Nico's Telephone is on low Battery at {{ states('sensor.date_time')
        }}
  - service: notify.hassnico_bot
    data:
      message: Nico's Telephone Battery Level is {{ states('sensor.batteria_telefono_nico')
        }}%

- id: notify-mamma-battery-low
  alias: Mamma Battery Low - Notification
  initial_state: 'on'
  trigger:
  - platform: numeric_state
    entity_id:
    - sensor.batteria_telefono_mamma
    above: 0
    below: 36
  action:
  - service: notify.hassnico_bot
    data:
      message: Mom's Telephone is on low Battery at {{ states('sensor.date_time')
        }}
  - service: notify.hassnico_bot
    data:
      message: Mom's Telephone Battery Level is {{ states('sensor.batteria_telefono_mamma')
        }}%

- id: notify-hass-start
  alias: Home Assistant Start - Notify
  initial_state: 'on'
  trigger:
    platform: homeassistant
    event: start
  action:
  - service: notify.hassnico_bot
    data:
      message: Home Assistant Start at {{ states('sensor.date_time') }}
  # - service: media_player.volume_set
  #   data:
  #     entity_id: media_player.nico_bose_home
  #     volume_level: 0.3
  - delay: 00:00:02
  - service: notify.alexa_media
    data:
      target:
      - media_player.nicolo_s_2nd_bose_home_speaker_500
      data:
        type: tts
      message: >
        '{{ [
        "Home Assistant è nuovamente disponibile",
        "Home Assistant è operativo",
        "Home assistant is back piccole bibbi",
        "Sono nuovamente operativa",
        "Signori e Signore Ladies and Gentlement Home assistant è nuovamente operativo",
        "Home assistant è avviato",
        ] | random }}'
  - service: recorder.purge
    data:
      keep_days: 7
      repack: true
  # - service: google_assistant.request_sync
  # - service: notify.hassnico_bot
  #   data:
  #     message: Google Assistant Sync at {{ states('sensor.date_time') }}
  - service: script.cast_on_kitchen


- id: notify-hass-stop
  alias: Home Assistant Stop - Notify
  initial_state: 'on'
  trigger:
    platform: event
    event_type: homeassistant_stop
  action:
    service: notify.hassnico_bot
    data:
      message: Home Assistant Stop at {{ states('sensor.date_time') }}

- id: zone-mamma-home
  alias: Mamma at Home - Notification
  initial_state: 'on'
  trigger:
    platform: zone
    event: enter
    zone: zone.home
    entity_id: device_tracker.mamma_mamma
  action:
    service: notify.hassnico_bot
    data:
      message: Mamma is at Home at {{ states('sensor.date_time') }}

- id: zone-mamma-out-home
  alias: Mamma Outside Home - Notification
  initial_state: 'on'
  trigger:
    platform: zone
    event: leave
    zone: zone.home
    entity_id: device_tracker.mamma_mamma
  action:
    service: notify.hassnico_bot
    data:
      message: Mamma is going out at {{ states('sensor.date_time') }}

- id: zone-maria-home
  alias: Maria at Home - Notification
  initial_state: 'on'
  trigger:
    platform: state
    entity_id: person.maria
    from: not_home
    to: home
  action:
  - service: notify.hassnico_bot
    data:
      message: Maria is at Home {{ states('sensor.date_time') }}
  - delay:
      seconds: 30
  # - service: media_player.volume_set
  #   data:
  #     entity_id: media_player.nico_bose_home
  #     volume_level: 0.35
  - delay: 00:00:02
  - service: notify.alexa_media
    data:
      target:
      - media_player.nicolo_s_2nd_bose_home_speaker_500
      data:
        type: tts
      message: >
        '{{ [ 
        "Bentornata a casa Maria",
        "Bentornata",
        "Ciao Mascia",
        "Sei bellissima oggi, è un piacere rivederti",
        "Sono felice di rivederti",
        "è un piacere averti qui",
        "Un membro della gang è a casa",
        "Welcome to the candy shop",
        "Mascia finalmente sei a casa",
        "Ci sei mancata Mascia, spero che la giornata sia andata bene",
        "Sono felicissima di vederti Mascia, come stai?",
        "La regina Mascia è a casa",
        "Sua Maestà sono felicissima di rivederla",
        "Mascia, stare qui non aveva senso senza di te. Ben Tornata!",
        ] | random }}'
  # - service: rest_command.ss_home_on
  # - service: rest_command.ss_preset_home
  # - delay:
  #     seconds: 10
  # - service: rest_command.ss_preset_living
  # - delay:
  #     seconds: 10
  # - service: rest_command.ss_preset_bedroom
  # - delay:
  #     seconds: 10
  # - service: rest_command.ss_preset_home

- id: zone-maria-out-home
  alias: Maria Outside Home - Notification
  initial_state: 'on'
  trigger:
    platform: state
    entity_id: device_tracker.iphone
    to: not_home
    for: 00:05:00
  action:
  - service: notify.hassnico_bot
    data:
      message: Maria is going out at {{ states('sensor.date_time') }}

- id: zone-konstantin-home
  alias: Konstantin at Home - Notification
  initial_state: 'on'
  trigger:
    platform: state
    entity_id: device_tracker.galaxy_s10e
    from: not_home
    to: home
  action:
  - service: notify.hassnico_bot
    data:
      message: Konstantin is at Home {{ states('sensor.date_time') }}
  - delay:
      seconds: 30
  # - service: media_player.volume_set
  #   data:
  #     entity_id: media_player.nico_bose_home
  #     volume_level: 0.35
  - delay: 00:00:02
  - service: notify.alexa_media
    data:
      target:
      - media_player.nicolo_s_2nd_bose_home_speaker_500
      data:
        type: tts
      message: >
        '{{ [ 
        "Ciao Konstantin",
        "Bentornato Konstantin",
        "Ciao Konstantin",
        "Ciao Costantino",
        ] | random }}'

- id: zone-natascia-home
  alias: Natascia at Home - Notification
  initial_state: 'on'
  trigger:
    platform: state
    entity_id: device_tracker.galaxy_note10
    from: not_home
    to: home
  action:
  - service: notify.hassnico_bot
    data:
      message: Konstantin is at Home {{ states('sensor.date_time') }}
  - delay:
      seconds: 30
  # - service: media_player.volume_set
  #   data:
  #     entity_id: media_player.nico_bose_home
  #     volume_level: 0.35
  - delay: 00:00:02
  - service: notify.alexa_media
    data:
      target:
      - media_player.nicolo_s_2nd_bose_home_speaker_500
      data:
        type: tts
      message: >
        '{{ [ 
        "Ciao Natascia",
        "Bentornata Natascia",
        ] | random }}'

- id: zone-nico-home
  alias: Nico at Home - Notification
  initial_state: 'on'
  trigger:
    platform: zone
    entity_id: person.nico
    zone: zone.home
    event: enter
  condition:
    condition: time
    after: 07:00:00
    before: '23:59:00'
  action:
  - service: notify.hassnico_bot
    data:
      message: Nico is at Home at {{ states('sensor.date_time') }}
  # - service: media_player.volume_set
  #   data:
  #     entity_id: media_player.echo_dot_di_nicolo
  #     volume_level: 0.35
  - delay: 00:00:03
  - service: notify.alexa_media
    data:
      target:
      - media_player.echo_dot_di_nicolo
      data:
        type: tts
      message: > 
        '{{ [ 
        "Nico è a casa di Mamma",
        "Nico è arrivato da Mamma",
        "Nico è andato a trovare la Mamma",
        "Wooow, Rossella è felicissima di vedere Nico",
        "Il boss è dalla mamma",
        ] | random }}'

- id: zone-nico-out-home
  alias: Nico is going out - Notification
  initial_state: 'on'
  trigger:
    platform: zone
    entity_id: device_tracker.sm_g950f
    zone: zone.home
    event: leave
  condition:
    condition: time
    after: 07:00:00
    before: '23:59:00'
  action:
  - service: notify.hassnico_bot
    data:
      message: Nico is going out from Home at {{ states('sensor.date_time') }}

- id: zone-nico-casetta
  alias: Nico at Home - Notification
  initial_state: 'on'
  trigger:
    platform: zone
    entity_id: device_tracker.sm_g950f
    zone: zone.casetta
    event: enter
  condition:
    condition: time
    after: 07:00:00
    before: '23:59:00'
  action:
  - service: notify.hassnico_bot
    data:
      message: Nico is at Casetta at {{ states('sensor.date_time') }}

- id: zone-nico-casetta2
  alias: Nico at Home 2 - Notification
  initial_state: 'on'
  trigger:
    platform: state
    entity_id: device_tracker.sm_g950f
    from: not_home
    to: home
  action:
  # - service: media_player.volume_set
  #   data:
  #     entity_id: media_player.nico_bose_home
  #     volume_level: 0.3
  - delay: 00:00:02
  - service: notify.alexa_media
    data:
      target:
      - media_player.nicolo_s_2nd_bose_home_speaker_500
      data:
        type: tts
      message: >
        '{{ [
        "Bentornato a casa Nico",
        "Nico sei finalmente a casa",
        "Si sente la differenza senza di te. Mi sei mancato",
        "Ci sei mancato",
        "Nico, ci sei mancato tantissimo",
        "Nico, Siamo felicissimi di vederti",
        "Ladies and Gentlement, Signori e Signore, Il boss è a casa",
         ] | random }}'
  - service: rest_command.ss_home_on
  - service: rest_command.ss_preset_home
  - delay:
      seconds: 10
  - service: rest_command.ss_preset_living
  - delay:
      seconds: 10
  - service: rest_command.ss_preset_bedroom
  - delay:
      seconds: 10
  - service: rest_command.ss_preset_home

- id: zone-nico-out-casetta
  alias: Nico is going out - Notification
  initial_state: 'on'
  trigger:
    platform: zone
    entity_id: device_tracker.sm_g950f
    zone: zone.casetta
    event: leave
  condition:
    condition: time
    after: 07:00:00
    before: '23:59:00'
  action:
  - service: notify.hassnico_bot
    data:
      message: Nico is going out from Casetta at {{ states('sensor.date_time') }}
  - service: script.alexatraffic2
  - service: rest_command.ss_preset_home
  - delay:
      seconds: 10
  - service: rest_command.ss_preset_living
  - delay:
      seconds: 10
  - service: rest_command.ss_preset_bedroom
  - delay:
      seconds: 10
  - service: rest_command.ss_preset_home

- id: zone-nico-dad-home
  alias: Nico at Papa's Home - Notification
  initial_state: 'on'
  trigger:
    platform: zone
    event: enter
    zone: zone.papa
    entity_id: device_tracker.sm_g950f
  action:
    service: notify.hassnico_bot
    data:
      message: Nico is at Papa's Home at {{ states('sensor.date_time') }}

- id: zone-nico-out-dad-home
  alias: Nico leaving Papa's Home - Notification
  initial_state: 'on'
  trigger:
    platform: zone
    event: leave
    zone: zone.papa
    entity_id: device_tracker.sm_g950f
  action:
    service: notify.hassnico_bot
    data:
      message: Nico is going out from Papa's Home {{ states('sensor.date_time') }}

- id: zone-nico-work
  alias: Nico at Work - Notification
  initial_state: 'on'
  trigger:
    platform: zone
    event: enter
    zone: zone.work
    entity_id: device_tracker.sm_g950f
  condition:
    condition: time
    after: 07:00:00
    before: '20:00:00'
    weekday:
    - mon
    - tue
    - wed
    - thu
    - fri
  action:
  - service: notify.hassnico_bot
    data:
      message: Nico at Work at {{ states('sensor.date_time') }}

- id: zone-nico-work-tigre
  alias: Nico at Work (Tigre) - Notification
  initial_state: 'on'
  trigger:
    platform: zone
    event: enter
    zone: zone.tigre
    entity_id: device_tracker.sm_g950f
  condition:
    condition: time
    after: 07:00:00
    before: '20:00:00'
    weekday:
    - mon
    - tue
    - wed
    - thu
    - fri
  action:
  - service: notify.hassnico_bot
    data:
      message: Nico at Work at {{ states('sensor.date_time') }}

- id: zone-nico-out-work
  alias: Nico out from Work - Notification
  initial_state: 'on'
  trigger:
    platform: zone
    event: leave
    zone: zone.work
    entity_id: device_tracker.sm_g950f
  condition:
    condition: time
    after: 07:00:00
    before: '20:00:00'
    weekday:
    - mon
    - tue
    - wed
    - thu
    - fri
  action:
  - service: notify.hassnico_bot
    data:
      message: Nico is going out from Work at {{ states('sensor.date_time') }}

- id: zone-nico-out-tigre
  alias: Nico out from Work (Tigre)) - Notification
  initial_state: 'on'
  trigger:
    platform: zone
    event: leave
    zone: zone.tigre
    entity_id: device_tracker.sm_g950f
  condition:
    condition: time
    after: 07:00:00
    before: '20:00:00'
    weekday:
    - mon
    - tue
    - wed
    - thu
    - fri
  action:
  - service: notify.hassnico_bot
    data:
      message: Nico is going out from Work at {{ states('sensor.date_time') }}

- id: notify-sunrise
  alias: Notify on sunrise
  initial_state: 'on'
  trigger:
    platform: sun
    event: sunrise
    offset: "+00:00:00"
  action:
  - service: notify.hassnico_bot
    data:
      message: Beautiful sunrise!
  - service: notify.hassnico_bot
    data:
      message: The sun is up. Wake Up! {{ states('sensor.date_time') }}


- id: notify-sunset
  alias: Notify on sunset
  initial_state: 'on'
  trigger:
    platform: sun
    event: sunset
    offset: "-00:59:00"
  action:
  - service: notify.hassnico_bot
    data:
      message: Beautiful sunset!
  - service: notify.hassnico_bot
    data:
      message: Oh wow you really missed something great. {{ states('sensor.date_time')
        }}
  # - service: media_player.volume_set
  #   data:
  #     entity_id: media_player.nico_bose_home
  #     volume_level: 0.3
  - service: notify.alexa_media
    data:
      target:
      - media_player.nicolo_s_2nd_bose_home_speaker_500
      data:
        type: tts
      message: >
        '{{ [ 
        "C'è un tramonto meraviglioso oggi, affacciati alla finestra",
        "Che ne pensi del tramonto di oggi? Non è Bellissimo?",
        ] | random }}'

- id: pc-restart
  alias: pc_restart
  trigger:
    platform: state
    entity_id: input_select.pcoptions
    to: Restart
  action:
  - service: shell_command.restart_pc
  - service: notify.hassnico_bot
    data:
      message: PC Restart at {{ states('sensor.date_time') }}
  # - service: media_player.volume_set
  #   data:
  #     entity_id: media_player.nico_bose_home
  #     volume_level: 0.3
  - service: script.alexascriptpcrestart

- id: pc-shutdown
  alias: pc_shutdown
  trigger:
    platform: state
    entity_id: input_select.pcoptions
    to: Shutdown
  action:
  - service: shell_command.shutdown_pc
  - service: notify.hassnico_bot
    data:
      message: PC Shutdown at {{ states('sensor.date_time') }}
  # - service: media_player.volume_set
  #   data:
  #     entity_id: media_player.nico_bose_home
  #     volume_level: 0.3
  - service: script.alexascriptpcoff


- id: pc-sleep
  alias: pc_sleep
  trigger:
    platform: state
    entity_id: input_select.pcoptions
    to: Sleep
  action:
  - service: shell_command.sleep_pc
  - service: notify.hassnico_bot
    data:
      message: PC Sleep at {{ states('sensor.date_time') }}


- id: pc-hibernate
  alias: pc_hibernate
  trigger:
    platform: state
    entity_id: input_select.pcoptions
    to: Hibernate
  action:
  - service: shell_command.hibernate_pc
  - service: notify.hassnico_bot
    data:
      message: PC Hibernated at {{ states('sensor.date_time') }}


- id: TTS-flush-cache
  alias: Flush TTS Cache
  initial_state: 'on'
  trigger:
    platform: time
    at: '2:35:00'
  action:
    service: tts.clear_cache

- id: telegram-start
  alias: Telegram Start Command
  initial_state: 'on'
  trigger:
    platform: event
    event_type: telegram_command
    event_data:
      command: /start
  action:
  - service: notify.hassnico_bot
    data:
      message: "{{ [ \"Ciao, sono il tuo assistente di casa.. Ti elenco seguito la\
        \ lista dei comandi disponibili\", \"Come posso esserti utile?\", \"Yes Sir!\"\
        , \"Se proprio insisti, questa è la lista dei comandi\", \"Aaaaa.. ancora\
        \ qui?\", \"E' un piacere rivederti\" ] | random }}       \n"
      data:
        keyboard:
        - /nico, /mamma
        - /nicopcon, /nicopcoff, /nicopcreboot
        - /ping, /camera
        - /start, /cp

- alias: Telegram_Bot_Stop
  id: 26fb96b64f5240eea48a862116bbaf53
  trigger:
  - platform: event
    event_type: telegram_callback
    event_data:
      data: /stop
  action:
  - service: notify.hassnico_bot
    data_template:
      message: '*Control Panel*'
      data:
        inline_keyboard:
        - 💡 Lights:/lights, 🚨 Security:/security
        - 💻 System:/system, 💻 Status:/status, Help:/help, Ping:/ping
        - 📄 Sommario:/Sommario, ☀ Weather:/weather
        - Addons:/addons


- id: telegram-camera-ss
  alias: Camera command
  initial_state: 'on'
  trigger:
    platform: event
    event_type: telegram_command
    event_data:
      command: /camera
  action:
  - service: notify.hassnico_bot
    data:
      message: E1 Pro - Salone - Snapshot
  - service: script.camera_snapshot

- id: telegram-ha-restart
  alias: Home Assistant restart
  initial_state: 'on'
  trigger:
    platform: event
    event_type: telegram_command
    event_data:
      command: /harestart
  action:
  - service: notify.alexa_media
    data:
      target:
      - media_player.nicolo_s_2nd_bose_home_speaker_500
      data:
        type: tts
      message: '{{ [ "Home Assistant si sta riavviando", "Riavvio Home Assistant",
        "Sto riavvando Home Assistant", "Riavvio Home Assistant", ] | random }}'
  - service: script.restart_ha
  - service: notify.hassnico_bot
    data:
      message: HA - Restart - Triggered

- id: telegram-nico-gps
  alias: GPS Notify Nico
  initial_state: 'on'
  trigger:
    platform: event
    event_type: telegram_command
    event_data:
      command: /nico
  action:
  - service: notify.hassnico_bot
    data:
      message: Nico GPS Position
  - service: script.nico_gps_notify_telegram

- id: telegram-mom-gps
  alias: GPS Notify Mom
  initial_state: true
  trigger:
    platform: event
    event_type: telegram_command
    event_data:
      command: /mamma
  action:
  - service: notify.hassnico_bot
    data:
      message: Mom GPS Position
  - service: script.mamma_gps_notify_telegram

- id: telegram-ca-renew
  alias: Certificate Renew
  initial_state: 'on'
  trigger:
    platform: event
    event_type: telegram_command
    event_data:
      command: /certificate
  action:
  - service: script.letsencrypt_renew

- id: telegram-ping-pong
  alias: Telegram bot that reply pong to ping
  initial_state: true
  trigger:
    platform: event
    event_type: telegram_command
    event_data:
      command: /ping
  action:
  - service: notify.hassnico_bot
    data:
      message: pong

- id: telegram-nico-pc-on
  alias: Telegram - Nico PC ON
  initial_state: true
  trigger:
    platform: event
    event_type: telegram_command
    event_data:
      command: /nicopcon
  action:
  - service: notify.hassnico_bot
    data:
      message: >
        '{{ [
        "Il PC è stato accesso",
        "Accendero il tuo PC nel piu breve tempo possibile!",
        "Yes Sir! Accendo subito il PC",
        "Aaaaa.. vuoi nuovamente che accendo il PC? Quanto rompi!",
        "Hmmm.. ok dai ti accendo il PC",
        "3.. 2.. 1.. ON"
        ] | random }}'
  - service: switch.turn_on
    entity_id: switch.nico_computer

- id: telegram-nico-pc-off
  alias: Telegram - Nico PC OFF
  initial_state: true
  trigger:
    platform: event
    event_type: telegram_command
    event_data:
      command: /nicopcoff
  action:
  - service: notify.hassnico_bot
    data:
      message: >
        '{{ [
        "Il PC è stato Spento",
        "Eddajee te lo spengooo",
        "Yes Sir! Spengo subito il PC",
        "Aaaaa.. vuoi nuovamente che spengo il PC? Quanto rompi!",
        "Hmmm.. ok dai ti spengo il PC",
        "3.. 2.. 1.. Off",
        ] | random }}'
  - service: shell_command.shutdown_pc

- id: telegram-nico-pc-reboot
  alias: Telegram - Nico PC Reboot
  initial_state: true
  trigger:
    platform: event
    event_type: telegram_command
    event_data:
      command: /nicopcreboot
  action:
  - service: notify.hassnico_bot
    data:
      message: > 
        '{{ [
        "Il PC è stato Riavviato",
        "Eddajee te lo riavvio",
        "Yes Sir! Riavvio subito il PC",
        "Aaaaa.. vuoi nuovamente che riavvio il PC? Quanto rompi!",
        "Hmmm.. ok dai ti riavvio il PC",
        "3.. 2.. 1.. Reboot"
        ] | random }}'
  - service: shell_command.restart_pc

- id: telegram-control-pannel-start
  alias: Telegram Control Pannel Command
  initial_state: 'on'
  trigger:
    platform: event
    event_type: telegram_command
    event_data:
      command: /cp
  action:
  - service: notify.hassnico_bot
    data:
      message: "{{ [ \"Home Assistant Status\", \"Control Panel\", \"Yes Sir!\", \"\
        Home Assistant Control Panel\", \"Pannello di controllo\" ] | random }}  \
        \     \n"
      data:
        inline_keyboard:
        - 💡 Lights:/lights, 🚨 Security:/security
        - 💻 System:/system, ℹ Status:/status, Help:/help, Ping:/ping
        - 📄 Sommario:/Sommario, ☀ Weather:/weather
        - Addons:/addons

- id: telegram-ik-ping-pong
  alias: telegram ping pong
  trigger:
  - platform: event
    event_type: telegram_callback
    event_data:
      data: /ping
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: 'Callback received from {{ trigger.event.data.from_first }}. Message
        id: {{ trigger.event.data.message.message_id }}. Data: {{ trigger.event.data.data
        }} {{now().strftime("%H:%M:%S %Y-%m-%d")}} Pong, Message from {{ trigger.event.data["user_id"]
        }}.'
      show_alert: true

- id: telegram-weather-info
  alias: Weather Info
  trigger:
  - platform: event
    event_type: telegram_callback
    event_data:
      data: /weather
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: Weather
  - service: notify.hassnico_bot
    data_template:
      message: '{{ "\U00002600" }} *Weather*:------------------------------------------------*Tempo*:   {{ states.sensor.dark_sky_summary_tmpl.state}}*Temp. Tomorrow Max/Min*:   {{ states.sensor.dark_sky_daytime_high_temperature_1d.state}}/{{
        states.sensor.dark_sky_overnight_low_temperature_1d.state}} °C*Forecasts*:   {{ states.sensor.dark_sky_hourly_summary_tmpl.state}}'
      data:
        inline_keyboard:
        - '{{ "\u21a9\ufe0f" }} Control Panel:/stop'

- id: telegram-system-status
  alias: System status
  trigger:
  - platform: event
    event_type: telegram_callback
    event_data:
      data: /status
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: System Status
  - service: notify.hassnico_bot
    data_template:
      message: "\n{{ \"\\U0001F4BB\" }} *System*:\n------------------------------------------------\
        \        \n*CPU Usage*:   {{ states.sensor.processor_use.state }} %\n*CPU\
        \ Up Time*:   {{ states.sensor.uptime.state }} h\n*Last Reboot*:   {{ states.sensor.last_boot.state\
        \ }}\n*Temp CPU*:   {{ states.sensor.cpu_temp.state }} °C\n*Free Memory*:\
        \   {{ states.sensor.memory_free.state }} Mb\n*Memory Used*:   {{ states.sensor.memory_usage_real.state\
        \ }} %\n  "
      data:
        inline_keyboard:
        - '{{ "\u21a9\ufe0f" }} Control Panel:/stop'

- id: telegram-ik-security-alarm
  alias: Telegram Alarm
  trigger:
  - platform: event
    event_type: telegram_callback
    event_data:
      data: /security
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: Alarm control
  - service: telegram_bot.edit_message
    data_template:
      message_id: last
      chat_id: '{{ trigger.event.data.user_id }}'
      message: '{% if is_state("input_boolean.burglar_alarm_door", "off") %}Alarm
        is OFF. {% else %}Alarm is ON. {% endif %} {% if is_state("input_boolean.away_scene",
        "off") %}Presence simulation is OFF. {% else %}Presence simulation is ON.
        {% endif %}'
      inline_keyboard:
      - Away ON:/away_on, Away OFF:/away_off
      - Alarm ON:/alarm_on, Alarm OFF:/alarm_off, Cancel:/cancel

- alias: Want pizza?
  id: e16c9ed3708b4ed988bd3768f1d6505b
  trigger:
    platform: time
    at: '18:30:00'
  condition:
  - condition: state
    entity_id: person.maria
    state: home
  - condition: state
    entity_id: person.nico
    state: not_home
  action:
  - service: telegram_bot.send_message
    data_template:
      title: Want pizza?
      target: '{{ trigger.event.data.user_id }}'
      #-189154344
      message: You look like you are home alone. Should I order you a pizza?
      inline_keyboard:
      - Gimme Pizza:/gimmepizza
      - No thanks:/nopizza


- alias: No pizza
  id: 00aea60bf4df41ea873af5bb00914bf9
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: /nopizza
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: Ok, no pizza then


- alias: gimme pizza
  id: 2664ed6ab9d04317a20914ac195ea623
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: /gimmepizza
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: PIZZA TIME
  - service: dominos.order
    data:
      order_entity_id: dominos.medium_pan


- alias: Lights Actions
  id: 395856c12a51458a8fcba2801af89a87
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: /lights
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: What you want to do with Lights?
  - service: telegram_bot.send_message
    data_template:
      title: Lights ON or OFF?
      target: -189154344
      message: Look like you want to turn on or off your lights. What you want to
        do?
      inline_keyboard:
      - ALL ON:/lighton, Living ON:/Living_on, Bedroom ON:/bedroom_on
      - ALL OFF:/lightoff, Living OFF :/Living_off, Bedroom OFF:/bedroom_off
      - Kitchen ON:/kitchen_on, BathRoom ON:/bath_on
      - Kitchen OFF:/kitchen_off, BathRoom OFF:/bath_off


- alias: IK - Telegram - Light On
  id: de9c96983e0249dca7ff6a383cf3fee5
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: /lighton
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: Lights ON
  - service: switch.turn_on
    data:
      entity_id: group.lights


- alias: IK - Telegram - Light Off
  id: a385f2a51e974e7087abced292444f08
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: /lightoff
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: Lights OFF
  - service: switch.turn_off
    data:
      entity_id: group.lights


- alias: IK - Telegram - Living Light On
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: /Living_on
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: Living Lights ON
  - service: switch.turn_on
    data:
      entity_id: group.living
  id: 93819def968a4138a042b2c9914cdcab

- alias: IK - Telegram - Living Light OFF
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: /Living_off
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: Living Lights OFF
  - service: switch.turn_off
    data:
      entity_id: group.living
  id: 4a791d4879af458caa18cdaf07396fb4

- alias: IK - Telegram - Kitchen Light On
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: /kitchen_on
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: Kitchen Lights ON
  - service: switch.turn_on
    data:
      entity_id: group.kitchen
  id: d0db7a6136df4543a9cec7e48d3755e2

- alias: IK - Telegram - Kitchen Light OFF
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: /kitchen_off
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: Kitchen Lights OFF
  - service: switch.turn_off
    data:
      entity_id: group.kitchen  
  id: c9d0f4d9d33e46eeb08bd93e09d79b51

- alias: IK - Telegram - BedRoom Light On
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: /bedroom_on
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: BedRoom Lights ON
  - service: switch.turn_on
    data:
      entity_id: group.bedroom
  id: a663b90a49864dfbb8e427077d0e7d38

- alias: IK - Telegram - BedRoom Light OFF
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: /bedroom_off
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: BedRoom Lights OFF
  - service: switch.turn_off
    data:
      entity_id: group.bedroom
  id: a73bc62c02204d9a9dc2acc57fb30f98

- alias: IK - Telegram - BathRoom Light On
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: /bath_on
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: BathRoom Lights ON
  - service: switch.turn_on
    data:
      entity_id: group.bathroom
  id: 84bbf8fc552e44b1841dd2d557baf6b1

- alias: IK - Telegram - BathRoom Light OFF
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: /bath_off
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: BathRoom Lights OFF
  - service: switch.turn_off
    data:
      entity_id: group.bathroom
  id: 82c1eddb9a694237bf7fbc5ee6581843

- alias: HA System Actions
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: /system
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: What actions you want to do on HA?
  - service: telegram_bot.send_message
    data_template:
      title: HA System Actions
      target: -189154344
      message: Look like you want to do something about your Home Assistant istance..
        What you want to do?
      inline_keyboard:
      - Check Config:/config, Automation Reload:/automreload
      - SSL certificate:/ssl, SSL Renew:/sslrenew
      - HA Restart:/harestart, Host Reboot:/hassioreboot
  id: cd77f15bdc134091bb724ff88c2209f2

- alias: IK - Telegram - Automation reload
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: /automreload
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: Automation Reload
  - service: script.reload_automations
  - service: notify.hassnico_bot
    data:
      message: Automation - Reload - Triggered
  id: fe7953d2058449c3ac8151413c59c52d

- alias: IK - Telegram - HA Restart
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: /harestart
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: HA restart
  - service: script.restart_ha
  - service: notify.hassnico_bot
    data:
      message: HA - Restart - Triggered
  id: 21923d7d73e64125b52f19622304c15e

- alias: IK - Telegram - SSL Renew
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: /sslrenew
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: SSL Renew
  - service: script.letsencrypt_renew
  - service: notify.hassnico_bot
    data:
      message: SSL - Renew - Triggered
  id: 5023c18fd0cb4ec2bd4ab9b40b270bdd

- alias: IK - Telegram - Host Reboot
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: /hassioreboot
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: Host Reboot
  - service: hassio.host_reboot
  - service: notify.hassnico_bot
    data:
      message: Host - Reboot - Triggered
  id: 4095dcaa857646dda279642d3af178c3

- alias: Addons Actions
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: /addons
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: What you want to do with these addons?
  - service: telegram_bot.send_message
    data_template:
      title: Addons
      target: -189154344
      message: Look like you want to turn on or off your Addons. What you want to
        do?
      inline_keyboard:
      - Web SSH ON:/webssh_on, Pi-Hole ON:/pihole_on
      - Web SSH OFF:/webssh_off, Pi-Hole OFF:/pihole_off
      - IDE ON:/ide_on, LogViewer ON:/logview_on
      - IDE OFF:/ide_off, LogViewer OFF:/logview_off
      - NodeRed ON:/nodered_on, NodeRed OFF:/nodered__off
  id: 881d4f591f03455e94096c5dd98a4318

- alias: IK - Telegram - Addon SSH Web Start
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: /webssh_on
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: Addon SSH Web Start - Triggered
  - service: hassio.addon_start
    data:
      addon: a0d7b954_ssh
  - service: notify.hassnico_bot
    data:
      message: SSH Enabled... Web SSH is available at https://nico-casetta.duckdns.org:7681
  id: 2bb0cd84615945419aaed0a414f64dd5

- alias: IK - Telegram - Addon SSH Web Stop
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: /webssh_off
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: Addon SSH Web Stop - Triggered
  - service: hassio.addon_stop
    data:
      addon: a0d7b954_ssh
  - service: notify.hassnico_bot
    data:
      message: Addon SSH Web Stopped
  id: 2c66fce6802d4be28ec41fe08123d8f0

- alias: IK - Telegram - Addon  Log Viewer Start
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: /logview_on
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: Addon  Log Viewer Start - Triggered
  - service: hassio.addon_start
    data:
      addon: a0d7b954_logviewer
  - service: notify.hassnico_bot
    data:
      message: ' Log Viewer... Log Viewer is available at https://nico-casetta.duckdns.org:4277'
  id: 417fccccf3ba4d4eafa4b8a23724689a

- alias: IK - Telegram - Addon  Log Viewer Stop
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: /logview_off
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: Addon  Log Viewer Stop - Triggered
  - service: hassio.addon_stop
    data:
      addon: a0d7b954_logviewer
  - service: notify.hassnico_bot
    data:
      message: Addon  Log ViewerStopped
  id: ea7b80b540ed4c5c8d0b2c7208ca8509

- alias: IK - Telegram - Addon  Pi-Hole Start
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: /logview_on
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: Addon  Pi-Hole Start - Triggered
  - service: hassio.addon_start
    data:
      addon: a0d7b954_pi-hole
  - service: notify.hassnico_bot
    data:
      message: Pi-Hole is available at https://nico-casetta.duckdns.org:4277
  
  id: 42d79f34480347ada179654f3fd48eca
- alias: IK - Telegram - Addon  Pi-Hole Stop
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: /logview_off
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: Addon  Pi-Hole Stop - Triggered
  - service: hassio.addon_stop
    data:
      addon: a0d7b954_pi-hole
  - service: notify.hassnico_bot
    data:
      message: Addon  Pi-Hole Stopped
  
  id: 7d27cedd571942178b4e3fad4dd99c3e
- alias: IK - Telegram - Addon  IDE Start
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: /ide_on
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: Addon  IDE Start - Triggered
  - service: hassio.addon_start
    data:
      addon: a0d7b954_ide
  - service: notify.hassnico_bot
    data:
      message: IDE is available at https://nico-casetta.duckdns.org:4277
  id: 093c013d0af544709a9dc40b406243ed

- alias: IK - Telegram - Addon  IDE Stop
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: /ide_off
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: Addon  IDE Stop - Triggered
  - service: hassio.addon_stop
    data:
      addon: a0d7b954_ide
  - service: notify.hassnico_bot
    data:
      message: Addon  IDE Stopped
  
  id: e17e1bf050034ad789250d6c110ee881
- alias: IK - Telegram - Addon  NodeRed Start
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: /nodered_on
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: Addon  NodeRed Start - Triggered
  - service: hassio.addon_start
    data:
      addon: a0d7b954_nodered
  - service: notify.hassnico_bot
    data:
      message: NodeRed is available at https://nico-casetta.duckdns.org:1880
  
  id: 74c5248c98f14ed0820ffe11bc3783a6
- alias: IK - Telegram - Addon  NodeRed Stop
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: /nodered_off
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: Addon  NodeRed Stop - Triggered
  - service: hassio.addon_stop
    data:
      addon: a0d7b954_nodered
  - service: notify.hassnico_bot
    data:
      message: Addon  NodeRed Stopped
  id: e15198a590af4101ac923b3787eb7d6c

- alias: Help
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: /help
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: Help sections
  - service: telegram_bot.send_message
    data_template:
      title: Help
      target: -189154344
      message: Look like you want to turn on or off your Addons. What you want to
        do?
      inline_keyboard:
      - Info Service Port:/info
  id: ef3df648d7f4471a820c96c0b31fb6f5

- alias: IK - Telegram - Help Info
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: /info
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: Help info - Triggered
  - service: notify.hassnico_bot
    data_template:
      message: "\n{{ \"\\U0001F4BB\" }} *Info*:\n------------------------------------------------\n\
        \ \n*HA*:   https://nico-casetta.duckdns.org:8123\n \n*SSH Web*:   https://nico-casetta.duckdns.org:7681\n\
        \ \n*Log Viewer*:   https://nico-casetta.duckdns.org:4277\n \n*Node Red*: \
        \  https://nico-casetta.duckdns.org:1880\n \n*Pi-Hole*:    https://nico-casetta.duckdns.org:4865"
      data:
        inline_keyboard:
        - '{{ "\u21a9\ufe0f" }} Control Panel:/stop'
  id: 6da100a00b0c42f1ba097145a470185f

- id: themes-sunset
  alias: Random Darker Theme At Sunset
  initial_state: true
  trigger:
    platform: sun
    event: sunset
  action:
  - service: frontend.set_theme
    data_template:
      name: '{{ ["darkcyan", "darkred", "midnight", "darkorange", "darkblue", "slate",
        "amoled", "material_dark_green", "material_dark_pink", "ios-dark-mode", "noctis"] | random  }}'

- id: themes-sunrise
  alias: Random Lighter Theme At Sunrise
  initial_state: true
  trigger:
    platform: sun
    event: sunrise
  action:
  - service: frontend.set_theme
    data_template:
      name: '{{ ["default", "slate", "amoled", "clear", "oxfordblue"] | random  }}'

- id: log-level
  alias: Log Level
  trigger:
    platform: state
    entity_id: input_select.log_level
  action:
    service: logger.set_level
    data_template:
      homeassistant.components: '{{ trigger.to_state.state }}'

- id: owntracks-refresh
  alias: Owntracks Refresh
  trigger:
  - platform: time_pattern
    minutes: /5
    seconds: 0
  action:
    service: script.owntracks_update

- id: family-coming-back
  alias: Family Coming Back to Home
  trigger:
    platform: state
    entity_id: group.family
    to: home
  action:
  - delay:
      seconds: 5
  - service: notify.alexa_media
    data:
      target:
      - media_player.nicolo_s_2nd_bose_home_speaker_500
      data:
        type: tts
      message: '{{ [ "Sono felice di rivedervi", "Bentornati a casa.", ] | random
        }}'
  # - service: rest_command.ss_home_on
  - service: notify.hassnico_bot
    data:
      message: >
       '{{ [
       "Qualcuno è tornato a casa",
       "Un Membro della gang è tornato a casa",
       "Un Membro della famiglia è tornato a casa",
        ] | random }}'
  - service: script.shutters_open_all

- id: family-going-out
  alias: Family Going Out
  trigger:
    platform: state
    entity_id: group.family
    to: not_home
  action:
  - delay:
      seconds: 5
  - service: notify.alexa_media
    data:
      target:
      - media_player.nicolo_s_2nd_bose_home_speaker_500
      data:
        type: tts
      message: '{{ [ "Mi Dispiace che ve ne andate", "Spero di rivedervi presto",
        ] | random }}'
  # - service: rest_command.ss_home_off
  - service: notify.hassnico_bot
    data:
      message: >
        '{{ [
        "Qualcuno è uscito da casa",
        "Qualcuno è uscito da casa",
        ] | random }}'
  - service: input_select.select_option
    data:
      entity_id: input_select.ac_state
      option: Power Off
  - service: cover.set_cover_position
    data:
      entity_id: cover.shelly_shsw_25_e6704f
      position: 22
  # - service: script.shutters_close_all
  - service: switch.turn_off
    data:
      entity_id: group.lights

#   id: 1ed32739e4b649659834ec85f0b01aa5
# - alias: IFTTT - Test Notification Received
#   initial_state: 'on'
#   trigger:
#     platform: event
#     event_type: ifttt_webhook_received
#     event_data:
#       action: call_service
#   action:
#     service_template: '{{ trigger.event.data.service }}'
#     data_template:
#       entity_id: '{{ trigger.event.data.entity_id }}'
  
#   id: f467e5667918486eb2b4168be00e7151
# - alias: IFTTT - Startup Notification
#   initial_state: 'on'
#   trigger:
#     platform: homeassistant
#     event: start
#   action:
#     service: ifttt.trigger
#     data:
#       event: HA_Start
#       value1: Hello World!
#   id: 8b228639aca84a4c8cfb52a558e78c45

# - alias: IFTTT - Startup Notification two
#   trigger:
#     platform: homeassistant
#     event: start
#   action:
#     service: script.ifttt_notify
#     data_template:
#       value1: 'HA Status:'
#       value2: '{{ trigger.event.data.entity_id.split('_')[1] }} is '
#       value3: '{{ trigger.event.data.to_state.state }}'

- alias: 'Trigger alarm while armed away'
  trigger:
    - platform: state
      entity_id: sensor.pir1
      to: 'active'
    - platform: state
      entity_id: sensor.pir2
      to: 'active'
    - platform: state
      entity_id: sensor.door
      to: 'open'
    - platform: state
      entity_id: sensor.window
      to: 'open'
  condition:
    - condition: state
      entity_id: alarm_control_panel.ha_alarm
      state: armed_away
  action:
    service: alarm_control_panel.alarm_trigger
    entity_id: alarm_control_panel.ha_alarm
  id: 7c7986eba7f94410b400ad0045ccbdfd

- alias: 'Send notification when alarm triggered'
  trigger:
    - platform: state
      entity_id: alarm_control_panel.ha_alarm
      to: 'triggered'
  action:
    - service: notify.hassnico_bot
      data:
        message: "ALARM! The alarm has been triggered"
  id: e3c9600df6f343e4ad010a7f900b49ab

- alias: 'Disarm alarm when door unlocked by keypad'
  trigger:
    - platform: state
      entity_id: sensor.front_door_lock_alarm_type
      to: '19'
      # many z-wave locks use Alarm Type 19 for 'Unlocked by Keypad'
  action:
    - service: alarm_control_panel.alarm_disarm
      entity_id: alarm_control_panel.house_alarm
  id: 57977b7dd37745728b3c4152539729ac

- alias: 'Send notification when alarm is Disarmed'
  trigger:
    - platform: state
      entity_id: alarm_control_panel.home_alarm
      to: 'disarmed'
  action:
    - service: notify.hassnico_bot
      data_template:
        message: "ALARM! The alarm is Disarmed at {{ states('sensor.date_time') }}"
  id: 00f3f26d34f44c50abbd18593c3bf3c3

- alias: 'Send notification when alarm is in pending status'
  trigger:
    - platform: state
      entity_id: alarm_control_panel.home_alarm
      to: 'pending'
  action:
    - service: notify.hassnico_bot
      data_template:
        message: "ALARM! The alarm is in pending status at {{ states('sensor.date_time') }}"
  id: 1e98346fd2a54596bf1dfbf642589a30

- alias: 'Send notification when alarm is Armed in Away mode'
  trigger:
    - platform: state
      entity_id: alarm_control_panel.home_alarm
      to: 'armed_away'
  action:
    - service: notify.hassnico_bot
      data_template:
        message: "ALARM! The alarm is armed in Away mode {{ states('sensor.date_time') }}"
  id: 838cf4d3b1c843e1a04b9faada033e85

- alias: 'Send notification when alarm is Armed in Home mode'
  trigger:
    - platform: state
      entity_id: alarm_control_panel.home_alarm
      to: 'armed_home'
  action:
    - service: notify.hassnico_bot
      data_template:
        # Using multi-line notation allows for easier quoting
        message: >
          ALARM! The alarm is armed in Home mode {{ states('sensor.date_time') }}
  id: d624aa68bbde45bcaa2c11c7a6ef40ed

- alias: Weekly Backup Friday at 3 AM
  initial_state: 'on'
  trigger:
    platform: time
    at: 03:00:00
  condition:
  - condition: time
    weekday:
    - mon
    - tue
    - wed
    - thu
    - fri
  action:
  - service: hassio.snapshot_full
    data_template:
      name: Automated Backup {{ now().strftime('%Y-%m-%d') }}
  - service: notify.hassnico_bot
    data_template:
      message: Creating backup named "Automated Backup {{ now().strftime('%Y-%m-%d') }}"
  id: d316d840e9fd4ebdbc748b2419853558

- alias: Weekly Backup to Google Friday at 3:30 AM
  initial_state: 'on'
  trigger:
    platform: time
    at: 03:30:00
  condition:
  - condition: time
    weekday:
    - mon
    - tue
    - wed
    - thu
    - fri
  action:
  - service: rest_command.google_backup
  id: 4df385d2bced4f73adb6b7e872261e8f

- alias: Earth Quake Alert
  trigger:
    platform: geo_location
    source: usgs_earthquakes_feed
    zone: zone.earth_quake_alert_zone
    event: enter
  condition:
    condition: template
    value_template: "{{ trigger.to_state.attributes.type == 'earthquake' }}"
  action:
  - service: persistent_notification.create
    data_template:
      message: "{{ trigger.to_state.name }} - {{ trigger.to_state.attributes.status }}"
      title: Earth Quake Alert
  - service: notify.hassnico_bot
    data_template:
      message: ALARM! Earth Quake Detected {{ states('sensor.date_time') }}
  - service: hassio.addon_stdin
    data_template:
      addon: 89275b70_dss_voip
      input:
        call_sip_uri: sip:+393402703738@sip.voipcheap.com
        message_tts: Allerta, E' stato registrato un Terremoto con intensità superiore a 4
  id: 098391ffd0574f8babccb9fcb4083568

- alias: Set Living Room Cover position
  initial_state: 'on'
  trigger:
  - platform: state
    entity_id: input_number.living_room_cover
  action:
  - service: cover.set_cover_position
    entity_id: cover.shelly_shsw_25_e6704f
    data:
      position: "{{ states('input_number.living_room_cover') | int }}"
  id: 140b23ad91dc4fb599916029df40042a

- alias: Flood Sensor - Notification
  id: e495de65acc84b3abad35bf92a9505fb
  initial_state: 'on'
  trigger:
    platform: template
    value_template: "{{ is_state_attr('sensor.shelly_shwt_1_694834_flood', 'flood', 'true') }}"
  action:
  - service: notify.hassnico_bot
    data:
      message: C'è una perdita d'acqua in magazzino
  - service: media_player.volume_set
    data:
      entity_id: media_player.nicolo_s_2nd_bose_home_speaker_500
      volume_level: 0.3
  - delay: 00:00:20
  - service: notify.alexa_media
    data:
      target:
      - media_player.nicolo_s_2nd_bose_home_speaker_500
      data:
        type: tts
      message: >
        {{ [ 
        "C'è una perdita d'acqua in magazzino controllare per terra vicino alla lavatrice",
        "C'è una perdita d'acqua in magazzino controllare per terra vicino alla lavatrice",
        ] | random }}

- id: nico-birthday-tomorrow
  alias: Birthday Nico Tomorrow
  initial_state: 'on'
  trigger:
  - platform: numeric_state
    entity_id: sensor.birthday_nico
    above: 0
    below: 2
  action:
  - service: notify.hassnico_bot
    data_template:
      message: "Domani è il compleanno di Nico"
  - service: notify.alexa_media
    data:
      target:
      - media_player.nicolo_s_2nd_bose_home_speaker_500
      data:
        type: tts
      message: >
               {{ [
                "Domani è il compleanno di Nico",
                "Domani è il compleanno di Nico",
                "Domani è il compleanno di Nico",
                "Domani è il compleanno di Nico",
                "Domani è il compleanno di Nico",
               ] | random }}

- id: nico-birthday-today
  alias: Birthday Nico Today
  initial_state: 'on'
  trigger:
  - platform: numeric_state
    entity_id: sensor.birthday_nico
    below: 1
  - platform: time_pattern
    hours: 08
    minutes: /55
    seconds: '00'
  condition:
    condition: and
    conditions:
    - condition: sun
      before: sunset
    - condition: sun
      after: sunrise
    - condition: numeric_state
      entity_id: sensor.birthday_nico
      below: 1
  action:
  - service: notify.hassnico_bot
    data_template:
      message: 'Oggi è il compleanno di Nico'
  - service: script.alexascriptbirthday_ita

- id: maria-birthday-tomorrow
  alias: Birthday Maria Tomorrow
  initial_state: 'on'
  trigger:
  - platform: numeric_state
    entity_id: sensor.birthday_mascia
    above: 0
    below: 2
  action:
  - service: notify.hassnico_bot
    data_template:
      message: 'Domani è il compleanno di Nico'
  - service: notify.alexa_media
    data:
      target:
      - media_player.nicolo_s_2nd_bose_home_speaker_500
      data:
        type: tts
      message: '{{ [ 
                "Domani è il compleanno di Maria",
                "Domani è il compleanno di Maria",
                ] | random }}'

- id: maria-birthday-today
  alias: Birthday Maria Today
  initial_state: 'on'
  trigger:
  - platform: time_pattern
    hours: 08
    minutes: /55
    seconds: '00'
  condition:
    condition: and
    conditions:
    - condition: sun
      before: sunset
    - condition: sun
      after: sunrise
    - condition: numeric_state
      entity_id: sensor.birthday_mascia
      below: 1
  action:
  - service: notify.hassnico_bot
    data_template:
      message: 'Oggi è il compleanno di Maria'
  - service: script.alexascriptbirthday_ita

- id: '157606988564489'
  alias: Notification Test Weekly TTS
  initial_state: 'on'
  trigger:
    platform: time
    at: '20:00:00'
  condition:
    condition: time
    weekday:
    - mon
    - tue
    - wed
    - thu
    - fri
  action:
    - service: notify.alexa_media
      data:
        target: 
          - media_player.nicolo_s_2nd_bose_home_speaker_500
          - media_player.echo_dot_di_nicolo
        #title: "My title for Echo show"
        data:
          type: announce
          #method: all
        message: "Questo è un test settimanale per il sistema di annunci Alexa."

- id: '1576069885644898'
  alias: Alexa Volume Quiet
  initial_state: 'on'
  trigger:
    platform: time
    at: '00:45:00'
  condition:
    condition: time
    weekday:
    - mon
    - tue
    - wed
    - thu
    - fri
    - sat
    - sun
  action:
    # - service: media_player.volume_set
    #   data:
    #     entity_id: media_player.nico_bose_home
    #     volume_level: 0.1
    - service: input_select.select_option
      data:
        entity_id: input_select.alexa_volume
        option: Quiet

- id: '1576069885644890'
  alias: Alexa Volume Normal
  initial_state: 'on'
  trigger:
    platform: time
    at: '09:00:00'
  condition:
    condition: time
    weekday:
    - mon
    - tue
    - wed
    - thu
    - fri
    - sat
    - sun
  action:
    # - service: media_player.volume_set
    #   data:
    #     entity_id: media_player.nico_bose_home
    #     volume_level: 0.2
    - service: input_select.select_option
      data:
        entity_id: input_select.alexa_volume
        option: Normal

- id: '1576069885644899'
  alias: Alexa Volume Movie
  initial_state: 'on'
  trigger:
    platform: time
    at: '20:00:00'
  condition:
    condition: time
    weekday:
    - mon
    - tue
    - wed
    - thu
    - fri
    - sat
    - sun
  action:
    # - service: media_player.volume_set
    #   data:
    #     entity_id: media_player.nico_bose_home
    #     volume_level: 0.3
    - service: input_select.select_option
      data:
        entity_id: input_select.alexa_volume
        option: Movie

- id: alexa-volume-quiet
  alias: Alexa Volume Quiet - Notification
  trigger:
    platform: state
    entity_id: input_select.alexa_volume
    to: Quiet
  action:
  - service: media_player.volume_set
    data:
      entity_id: media_player.nico_bose_home
      volume_level: 0.1
  - service: media_player.volume_set
    data:
      entity_id: media_player.nicolo_s_2nd_bose_home_speaker_500
      volume_level: 0.1
  - service: media_player.volume_set
    data:
      entity_id: media_player.echo_dot_di_nicolo
      volume_level: 0.2

  - service: notify.hassnico_bot
    data_template:
      message: 'Alexa Volume is {{ trigger.to_state.state }}'

- id: alexa-volume-normal
  alias: Alexa Volume Normal - Notification
  trigger:
    platform: state
    entity_id: input_select.alexa_volume
    to: Normal
  action:
  - service: media_player.volume_set
    data:
      entity_id: media_player.nico_bose_home
      volume_level: 0.2
  - service: media_player.volume_set
    data:
      entity_id: media_player.nicolo_s_2nd_bose_home_speaker_500
      volume_level: 0.2
  - service: media_player.volume_set
    data:
      entity_id: media_player.echo_dot_di_nicolo
      volume_level: 0.4
  - service: notify.hassnico_bot
    data_template:
      message: 'Alexa Volume is {{ trigger.to_state.state }}'

- id: alexa-volume-Movie
  alias: Alexa Volume Movie - Notification
  trigger:
    platform: state
    entity_id: input_select.alexa_volume
    to: Movie
  action:
  - service: media_player.volume_set
    data:
      entity_id: media_player.nico_bose_home
      volume_level: 0.3
  - service: media_player.volume_set
    data:
      entity_id: media_player.nicolo_s_2nd_bose_home_speaker_500
      volume_level: 0.3
  - service: media_player.volume_set
    data:
      entity_id: media_player.echo_dot_di_nicolo
      volume_level: 0.5
  - service: notify.hassnico_bot
    data_template:
      message: 'Alexa Volume is {{ trigger.to_state.state }}'

### Google cast ###


- id: cast-to-hub
  alias: Cast to Hub
  trigger: 
    - platform: state
      entity_id: media_player.cucina
      to: 'idle'
      for:
        minutes: 1
  action:
    - service: script.cast_on_kitchen

- id: cast-to-hub2
  alias: Cast to Hub
  trigger: 
    - platform: state
      entity_id: media_player.cucina
      to: 'on'
      for:
        minutes: 1
  action:
    - service: script.cast_on_kitchen


- id: energy-tarrif
  alias: Tariff Energy
  trigger:
    - platform: time
      at: '07:00:00'
    - platform: time
      at: '19:00:00'
  action:
    - service: utility_meter.next_tariff
      entity_id: utility_meter.daily_energy
    - service: utility_meter.next_tariff
      entity_id: utility_meter.monthly_energy


# ###################################
# #### Air conditioner Routines #####
# ###################################

# ### AC Power Off Routine and Self Shutdown

- id: ac-state-shutdown
  alias: AC state Shutdown
  initial_state: 'on'
  trigger:
  - platform: state
    entity_id:
    - switch.air
    - switch.air2
    - switch.air3
    to: 'off'
  action:
  - service: input_select.select_option
    data:
      entity_id: input_select.ac_state
      option: Power Off

- id: ac-self-shutdown
  alias: AC Self Shutdown
  initial_state: 'on'
  trigger:
  - platform: state
    entity_id:
    - switch.air
    - switch.air2
    to: 'on'
    for: 03:00:00
  - platform: state
    entity_id:
    - switch.air3
    to: 'on'
    for: 03:00:00
  action:
  - service: input_select.select_option
    data:
      entity_id: input_select.ac_state
      option: Power Off
  - service: switch.turn_off
    data_template:
      entity_id: ' {{ trigger.entity_id }} '
  - service: notify.hassnico_bot
    data_template:
      #message: "{{ trigger.to_state.attributes.friendly_name }} just changed from {{ trigger.to_state.state }} to {{ trigger.from_state.state }} - AC Self Shutdown Notify"
      message: '"Self Shutdown Notify - {{ trigger.to_state.attributes.friendly_name }} just changed from
        {{ trigger.to_state.state }} to {{ trigger.from_state.state }}."'
  - delay: 00:00:03
  - service: notify.alexa_media
    data:
      target:
      - media_player.nicolo_s_2nd_bose_home_speaker_500
      data:
        type: tts
      message: >
         {{ [
         "Risparmio Energetico attivato, ora spengo il condizionatore",
         "L'aria condizionata è stata spenta automaticamente",
         "Risparmio energetico attivo, spengo il condizonatore",       
         ] | random }}

- id: scene-ac-power-off
  alias: AC Scene Power Off - Notification
  trigger:
    platform: state
    entity_id: input_select.ac_state
    to: Power Off
  action:
  - service: switch.turn_off
    entity_id: switch.air2
  - delay:
      seconds: 10
  - service: switch.turn_off
    entity_id: switch.air
  - delay:
      seconds: 10
  - service: switch.turn_off
    entity_id: switch.air3
  - service: notify.hassnico_bot
    data_template:
      message: 'AC is on Mode: {{ trigger.to_state.state }}'
  - service: notify.hassnico_bot
    data:
      message: L'aria condizionata è stata Spenta (Power Off Mode)
  # - service: notify.alexa_media
  #   data:
  #     target:
  #     # - media_player.nico_bose_home
  #     - media_player.nicolo_s_2nd_bose_home_speaker_500
  #     data:
  #       type: tts
  #     message: >
  #      {{ [
  #      "Ho spento l'aria condizionata",
  #      "L'aria condizionata è stata spenta",
  #      ] | random }}

- id: ac-status-change-to-off
  alias: AC Status Change to OFF
  trigger:
    platform: state
    entity_id:
    - switch.air
    - switch.air2
    - switch.air3
    to: 'off'
  action:
  - service: input_select.select_option
    data:
      entity_id: input_select.ac_state
      option: Power Off
  - service: notify.hassnico_bot
    data_template:
      message: '"Status Change Notify - {{ trigger.to_state.attributes.friendly_name }} just changed from
        {{ trigger.to_state.state }} to {{ trigger.from_state.state }}."'

#### AC Spring Routine ###

- id: scene-spring-high-temperature-notify
  alias: AC Spring High temperature - Notification
  initial_state: 'on'
  trigger:
    - platform: numeric_state
      entity_id: sensor.termosifone_cucina_temperature
      above: 23
    # - platform: time
    #   at: "09:00:00"
    - platform: time_pattern
    # You can also match on interval. This will match every 30 minutes
      minutes: "/15"
  condition:
    # - condition: template
    #   value_template: "{{ is_state('sensor.season', 'spring') }}"
    - condition: state
      entity_id: sensor.season
      state: 'spring'
    - condition: numeric_state
      entity_id: 'sensor.shelly_shem_b9ee2d_1_current_consumption'
      below: 2000
    - condition: state
      entity_id: group.family
      state: home
    - condition: numeric_state
      entity_id: sensor.indice_thom_salone
      above: 23
    - condition: time
      after: '08:00:00'
      before: '22:00:00'
      weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
      - sat
      - sun
  action:
  - service: input_select.select_option
    data:
      entity_id: input_select.ac_state
      option: Spring

- id: scene-spring-low-temperature-notify
  alias: AC Spring low temperature - Notification
  initial_state: 'on'
  trigger:
    - platform: numeric_state
      entity_id: sensor.indice_thom_salone
      below: 21
    # - platform: time
    #   at: "09:00:00"
    - platform: time_pattern
    # You can also match on interval. This will match every 30 minutes
      minutes: "/30"
  condition:
    condition: and
    conditions:
      - condition: not
        conditions:
        - condition: state
          entity_id: input_select.ac_mode
          state: 'Manual'
      - condition: and
        conditions:
        - condition: template
          value_template: "{{ is_state('sensor.season', 'spring') }}"
        - condition: numeric_state
          entity_id: 'sensor.shelly_shem_b9ee2d_1_current_consumption'
          below: 2000
        - condition: state
          entity_id: group.family
          state: home
        - condition: numeric_state
          entity_id: sensor.indice_thom_salone
          above: 23
        - condition: time
          after: '08:00:00'
          before: '22:00:00'
          weekday:
          - mon
          - tue
          - wed
          - thu
          - fri
          - sat
          - sun
  action:
  - service: input_select.select_option
    data:
      entity_id: input_select.ac_state
      option: Power Off
  - service: notify.hassnico_bot
    data:
      message: E' Stata raggiunta la soglia di benessere dell'indicatore Thom (Spring Mode)


- id: scene-ac-spring
  alias: AC Scene Spring - Notification
  trigger:
    platform: state
    entity_id: input_select.ac_state
    to: Spring
  action:
  - service: switch.turn_on
    entity_id: switch.air2
  - delay:
      seconds: 10
  - service: switch.turn_on
    entity_id: switch.air2
  - service: notify.hassnico_bot
    data_template:
      message: 'AC is on Spring Mode: {{ trigger.to_state.state }}'
  - service: notify.hassnico_bot
    data:
      message: L'aria condizionata è stata attiva in Salotto (Spring Mode)
  - service: notify.hassnico_bot
    data:
      message: La temperatura ha superato il limite prefissato di 27 gradi (Spring Mode)
  - service: notify.alexa_media
    data:
      target:
      # - media_player.nico_bose_home
      - media_player.nicolo_s_2nd_bose_home_speaker_500
      data:
        type: tts
      message: >
       {{ [
       "Ho notato che in Salone fa troppo caldo. Accendo l'aria condizionata per rinfrascarre l'aria",
       "Mamma mia che caldo, accendo l'aria condizionata",       
       ] | random }}



#### AC Summer Routine ###

# - id: scene-summer-high-temperature-notify
#   alias: AC Summer High temperature - Notification
#   initial_state: 'on'
#   trigger:
#     - platform: numeric_state
#       entity_id: sensor.indice_thom_salone
#       above: 23
#     # - platform: time
#     #   at: "08:00:00"
#     - platform: time_pattern
#     # You can also match on interval. This will match every 30 minutes
#       minutes: "/30"
#   condition:
#     # - condition: template
#     #   value_template: "{{ is_state('sensor.season', 'summer') }}"
#     - condition: state
#       entity_id: sensor.season
#       state: 'summer'
#     - condition: numeric_state
#       entity_id: 'sensor.shelly_shem_b9ee2d_1_current_consumption'
#       below: 2000
#     - condition: state
#       entity_id: group.family
#       state: home
#     - condition: numeric_state
#       entity_id: sensor.indice_thom_salone
#       above: 23
#     - condition: time
#       after: '08:00:00'
#       before: '22:00:00'
#       weekday:
#       - mon
#       - tue
#       - wed
#       - thu
#       - fri
#       - sat
#       - sun
#   action:
#   - service: input_select.select_option
#     data:
#       entity_id: input_select.ac_state
#       option: Summer

- id: scene-summer-high-temperature-notify
  alias: AC Summer High temperature - Notification
  initial_state: 'on'
  trigger:
    - platform: numeric_state
      entity_id: sensor.indice_thom_salone
      above: 23
    - platform: time_pattern
      minutes: "/5"
  condition:
    condition: and
    conditions:
      - condition: not
        conditions:
        - condition: state
          entity_id: input_select.ac_mode
          state: 'Manual'
      - condition: and
        conditions:
        - condition: state
          entity_id: sensor.season
          state: 'summer'
        - condition: numeric_state
          entity_id: 'sensor.shelly_shem_b9ee2d_1_current_consumption'
          below: 2000
        - condition: state
          entity_id: group.family
          state: home
        - condition: numeric_state
          entity_id: sensor.indice_thom_salone
          above: 23
        - condition: time
          after: '06:00:00'
          before: '22:00:00'
          weekday:
          - mon
          - tue
          - wed
          - thu
          - fri
          - sat
          - sun
  action:
  - service: input_select.select_option
    data:
      entity_id: input_select.ac_state
      option: Summer


- id: scene-summer-low-temperature-notify
  alias: AC Summer low temperature - Notification
  initial_state: 'on'
  trigger:
    - platform: numeric_state
      entity_id: 'sensor.indice_thom_salone'
      below: 22
    - platform: time
      at: "08:00:00"
  condition:
    - condition: template
      value_template: "{{ is_state('sensor.season', 'summer') }}"
    - condition: state
      entity_id: group.family
      state: home
    - condition: numeric_state
      entity_id: 'sensor.indice_thom_salone'
      below: 22
    - condition: time
      after: '08:00:00'
      before: '22:00:00'
      weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
      - sat
      - sun
  action:
  - service: input_select.select_option
    data:
      entity_id: input_select.ac_state
      option: Power Off
  - service: notify.hassnico_bot
    data:
      message: E' Stata raggiunta la soglia di benessere dell'indicatore Thom (Summer Mode)


- id: scene-ac-summer
  alias: AC Scene Summer - Notification
  trigger:
    platform: state
    entity_id: input_select.ac_state
    to: Summer
  action:
  - service: switch.turn_on
    entity_id: switch.air2
  - delay:
      seconds: 10
  - service: switch.turn_on
    entity_id: switch.air2
  - service: notify.hassnico_bot
    data_template:
      message: 'AC is on summer Mode: {{ trigger.to_state.state }}'
  - service: notify.hassnico_bot
    data:
      message: L'aria condizionata è stata attiva in Salotto (Summer Mode)
  # - service: notify.alexa_media
  #   data:
  #     target:
  #     # - media_player.nico_bose_home
  #     - media_player.nicolo_s_2nd_bose_home_speaker_500
  #     data:
  #       type: tts
  #     message: >
  #      {{ [
  #      "Ho notato che in Salone fa troppo caldo. Accendo l'aria condizionata per rinfrascarre l'aria",
  #      "Che caldo, accendo l'aria condizionata",       
  #      ] | random }}


================================================
FILE: camera.yaml
================================================
- platform: onvif
  host: 1.1.1.1
  username: !secret e1user
  password: !secret e1pwd
  port: 5000

- platform: generic
  still_image_url: https://www.autostrade.it/autostrade-gis/popupVideocam.do?tlc=3141
  name: PGeneric
 
- platform: mjpeg
  mjpeg_url: https://www.autostrade.it/autostrade-gis/popupVideocam.do?tlc=3141
  name: Pmjpeg
  
- platform: generic
  still_image_url: http://api.sat24.com/animated/IT/visual/1/Central%20European%20Standard%20Time/2380259'%20width=400%20height=291
  name: Rome
- platform: generic
  name: Nico
  still_image_url: https://maps.googleapis.com/maps/api/staticmap?center={{states.device_tracker.nico_nico.attributes.latitude}},{{states.device_tracker.nico_nico.attributes.longitude}}&zoom=15&size=500x500&maptype=roadmap&markers=color:blue%7Clabel:P%7C{{states.device_tracker.nico_nico.attributes.latitude}},{{states.device_tracker.nico_nico.attributes.longitude}}&keyYOURAPIKEY   
  limit_refetch_to_url_change: true
- platform: generic
  name: Mamma
  still_image_url: https://maps.googleapis.com/maps/api/staticmap?center={{states.device_tracker.mamma_mamma.attributes.latitude}},{{states.device_tracker.mamma_mamma.attributes.longitude}}&zoom=15&size=500x500&maptype=roadmap&markers=color:blue%7Clabel:P%7C{{states.device_tracker.mamma_mamma.attributes.latitude}},{{states.device_tracker.mamma_mamma.attributes.longitude}}&keyYOURAPIKEY
  limit_refetch_to_url_change: true
- platform: generic
  name: ISS
  still_image_url: https://maps.googleapis.com/maps/api/staticmap?center={{states.binary_sensor.iss.attributes.lat}},{{states.binary_sensor.iss.attributes.long}}&zoom=3&size=500x500&maptype=roadmap&markers=color:blue%7Clabel:P%7C{{states.binary_sensor.iss.attributes.lat}},{{states.binary_sensor.iss.attributes.long}}&keyYOURAPIKEY 
  limit_refetch_to_url_change: true

================================================
FILE: configuration.yaml
================================================
####################################################
#                                                  #
#                Default Config                    #
#                                                  #
####################################################
# https://www.home-assistant.io/integrations/default_config/
# Configure a default setup of Home Assistant (frontend, api, etc)
#default_config:
person:
updater:
zone:
zeroconf:
system_health:
sun:
ssdp:
map:
logbook:
config:
history:
logger:
  default: info

####################################################
#                                                  #
#                   CUSTOMIZING                    #
#                                                  #
####################################################
# https://www.home-assistant.io/docs/configuration/customizing-devices/
#https://home-assistant.io/docs/configuration/basic/
homeassistant:
  auth_providers: 
   - type: homeassistant
   #- type: legacy_api_password
   - type: trusted_networks
     trusted_networks:
       - 127.0.0.1
       - ::1
       - fd00::/8
  name: !secret name
  temperature_unit: C
  time_zone: !secret timezone
  latitude: !secret latitude
  longitude: !secret longitude
  unit_system: metric
  elevation: 47
  customize: !include customize.yaml
  customize_glob: !include customize_glob.yaml
  packages: !include_dir_named packages
  whitelist_external_dirs:
    - /config

####################################################
#                                                  #
#                     HTTP                         #
#                                                  #
####################################################
# https://www.home-assistant.io/integrations/http/
http:
  #base_url: https://nomescelto.duckdns.org:8123
  ssl_certificate: /ssl/fullchain.pem
  ssl_key: /ssl/privkey.pem
  ip_ban_enabled: True
  login_attempts_threshold: 5

####################################################
#                                                  #
#                     TTS                          #
#                                                  #
####################################################
# https://www.home-assistant.io/integrations/tts/
# Text to speech
tts:
  - platform: google_translate

####################################################
#                                                  #
#                  Groups                          #
#                                                  #
####################################################
# https://www.home-assistant.io/integrations/mobile_app/
group: !include groups.yaml

####################################################
#                                                  #
#                  Automations                     #
#                                                  #
####################################################
# https://www.home-assistant.io/integrations/automation/
automation: !include automations.yaml

####################################################
#                                                  #
#                  Scripts                         #
#                                                  #
####################################################
# https://www.home-assistant.io/integrations/script/
script: !include scripts.yaml

####################################################
#                                                  #
#                   Scene                          #
#                                                  #
####################################################
# https://www.home-assistant.io/integrations/scene/
scene: !include scenes.yaml


####################################################
#                                                  #
#                  Mobile APP                      #
#                                                  #
####################################################
# https://www.home-assistant.io/integrations/mobile_app/
mobile_app:

####################################################
#                  Dev Tracker                     #
#                                                  #
#                                                  #
####################################################
# https://www.home-assistant.io/integrations/device_tracker/
device_tracker: !include device_tracker.yaml

####################################################
#                  Dev Tracker                     #
#                   Owntracks                      #
#                                                  #
####################################################
# https://www.home-assistant.io/integrations/owntracks/
# Disable cause enabled in Integrations
# owntracks:
#   max_gps_accuracy: 200

####################################################
#                                                  #
#                   Camera                         #
#                                                  #
####################################################
# https://www.home-assistant.io/integrations/camera/
camera: !include camera.yaml

####################################################
#                                                  #
#                   MQTT                           #
#                                                  #
####################################################
# https://www.home-assistant.io/integrations/mqtt/
# Disable cause enabled from integrations
# mqtt: !include mqtt.yaml

####################################################
#                                                  #
#               Frontend/Themes                    #
#                                                  #
####################################################
frontend:
  extra_module_url:
    - /hacsfiles/custom-sidebar/custom-sidebar.js
  #themes: !include themes.yaml
  themes: !include_dir_merge_named themes


####################################################
#                                                  #
#              Input Slider and Boolean            #
#                                                  #
####################################################

#input_boolean: !include_dir_merge_named input_boolean
input_select: !include_dir_merge_named input_select
input_number: !include_dir_merge_named input_number



notify: !include notify.yaml
telegram_bot:
   - platform: polling
     api_key: !secret telegram_apikey
     #trusted_networks:
      #- 149.154.167.197/32
      #- 149.154.167.198/31
      #- 149.154.167.200/29
      #- 149.154.167.208/28
      #- 149.154.167.224/29
      #- 149.154.167.232/31
     allowed_chat_ids:
       - !secret telegram_clientid
       - !secret telegram_clientid2


sensor: !include sensor.yaml


####################################################
#                                                  #
#                   Recorder                       #
#                                                  #
####################################################

recorder:
   db_url: !secret dburl
   purge_keep_days: 30   
   commit_interval: 60
   exclude:
    domains:
      #- automation
      - weblink
      - updater
      - sensor
      - binary_sensor
      - zone
      - sun
      - camera
      - media_player
      - switch
      - mqtt
      - calendar
      - frontend
    entities:
      - sensor.date
      - sun.sun
      - weather.dark_sky      
   include:
    entities:
      - cover.shelly_shsw_25_e6704f
      - switch.shelly_shsw_25_68796e_1
      - switch.shelly_shsw_25_68796e_2
      - switch.shelly_shsw_25_686d62_1
      - switch.shelly_shsw_25_686d62_2
      - switch.shelly_shsw_25_687269_1
      - switch.shelly_shsw_25_687269_2
      - switch.shelly_shsw_25_e5e601_1
      - switch.shelly_shsw_25_e5e601_2
      - switch.shelly_shplg_s_041a07
      - switch.shelly_shplg_s_0409b4
      - switch.air
      - switch.air2
      - switch.air3
      - switch.nico_computer
      - switch.shelly_shplg_s_7a33ff
      - switch.fritz_box_guest_wifi
      - switch.shelly_shplg_s_041a76
      - switch.ciabatta_rack_fritz_dect_200_1
      - switch.presa_rasp_pi3_fritz_dect_200_2       
      - switch.shelly_shplg_s_04169c
      - switch.shelly_shplg_s_5b2502
      - sensor.shelly_shwt_1_694834_flood
      - sensor.shelly_shwt_1_694834_temperature
      - sensor.potenza_istantanea
      - sensor.batteria_telefono_nico
      - sensor.batteria_telefono_mamma
      - sensor.processor_use
      - sensor.shelly_flood_battery
      - device_tracker.nico_nico
      - device_tracker.mamma_mamma
      - sensor.living_room_humidity
      - sensor.living_room_temperature
      - sensor.kitchen_humidity
      - sensor.kitchen_temperature
      - sensor.bedroom_humidity
      - sensor.bedroom_temperature
      - sensor.cpu_temp
      - sensor.ssl_certificate_expiry
      - sensor.shelly_shem_b9ee2d_1_current_consumption
      - sensor.termosifone_cucina_temperature
      - sensor.termosifone_notte_temperature 
      - sensor.termosifone_salone_temperature
      - sensor.termosifone_salone_humidity
      - sensor.termosifone_notte_humidity
      - sensor.termosifone_cucina_humidity
      - sensor.shelly_shem_b9ee2d_1_total_consumption_attr
      - input_datetime.start_night
      - sensor.command_sensor
      - sensor.energy_spent
      - sensor.indice_thom_salone
      - sensor.indice_thom_cucina
      - sensor.indice_thom_camera

shelly:
  discovery: true  #add all devices (default)
  username: !secret shellyuser
  password: !secret shellypwd
  sensors:
    - all
  attributes:
    - all
  cloud_auth_key: !secret shellycloudapi
  cloud_server: !secret shellycloudserver


####################################################
#                                                  #
#                     ALEXA                        #
#                                                  #
####################################################
# alexa_media:
#   accounts:
#     - email: !secret amazonemail
#       password: !secret amazonpwd
#       #url: !secret amazonurl
#       url: !secret amazonurl_it
#       scan_interval: 30
      #debug: true
      #exclude_devices:
      #- "This Device"
      #- "nicolo's Alexa Apps"
      #- "nicolo's bose home speaker 500"
      #- "echo dot di nicolo"
      #- "salotto"


####################################################
#                                                  #
#             Lovelace/CustomUpdater               #
#                                                  #
####################################################

#https://www.home-assistant.io/lovelace/yaml-mode/
lovelace:
  mode: yaml
  resources:
    - url: /local/monster-card.js   
      type: js 
    - url: /local/custom-lovelace/weather-card/weather-card.js 
      type: module 
    - url: /local/plugins/card-tools.js
      type: js
    - url: /hacsfiles/plan-coordinates/plan-coordinates.js 
      type: js   
    - url: /hacsfiles/atomic_calendar/atomic_calendar.js     
      type: module
    - url: /hacsfiles/atomic-calendar-revive/atomic-calendar-revive.js     
      type: module
    - url: /hacsfiles/mini-media-player/mini-media-player-bundle.js
      type: module 
    - url: /hacsfiles/mini-graph-card/mini-graph-card-bundle.js 
      type: module
    - url: /hacsfiles/lovelace-slider-entity-row/slider-entity-row.js
      type: module
    - url: /hacsfiles/fitbit-card/fitbit-card.js
      type: js
    - url: /hacsfiles/secondaryinfo-entity-row/secondaryinfo-entity-row.js 
      type: module 
    - url: /hacsfiles/lovelace-auto-entities/auto-entities.js  
      type: module
    - url: /hacsfiles/lovelace-fold-entity-row/fold-entity-row.js
      type: module
    - url: /hacsfiles/lovelace-card-tools/card-tools.js  
      type: module     
    - url: /hacsfiles/unused-card/unused-card.js
      type: module
    - url:  /hacsfiles/shutter-cover-panel-card/shutter-cover-panel-card.js
      type: module
    - url: /hacsfiles/LG-WebOS-Remote-Control/lg-remote-control.js
      type: module
    - url: /hacsfiles/LG-Keypad/card-numeric-pad.js
      type: module
    - url: /hacsfiles/canvas-gauge-card/canvas-gauge-card.js
      type: module
    - url: /hacsfiles/custom-header/custom-header.js
      type: module
    - url: /hacsfiles/logbook-card/logbook-card.js
      type: module
    - url: /hacsfiles/username-element/username-element.js
      type: module
    - url: /hacsfiles/weather-card/weather-card.js
      type: module
    - url: /hacsfiles/custom-sidebar/custom-sidebar.js
      type: module
    - url: /hacsfiles/button-card/button-card.js
      type: module


switch: !include switch.yaml
binary_sensor: !include binary_sensors.yaml

####################################################
#                                                  #
#                   SPEEDTEST                      #
#                                                  #
####################################################

#https://www.home-assistant.io/components/speedtestdotnet/
speedtestdotnet:
  server_id: 3243 # server "Telecom Italia S.p.A." Rome
  scan_interval:
    hours: 4
  monitored_conditions:
    - ping
    - download
    - upload

####################################################
#                                                  #
#                    Weather                       #
#                                                  #
####################################################

#https://www.home-assistant.io/components/weather.darksky/
weather:
  - platform: darksky
    api_key: !secret darksky
    mode: daily

####################################################
#                                                  #
#                 Media player                     #
#                                                  #
####################################################
# https://www.home-assistant.io/integrations/media_player/
# https://www.home-assistant.io/integrations/universal/
# https://www.home-assistant.io/integrations/androidtv/

media_player: !include media_player.yaml

####################################################
#                                                  #
#                 Shell Commands                   #
#                                                  #
####################################################
# https://www.home-assistant.io/integrations/shell_command/

shell_command: !include shell_commands.yaml


####################################################
#                    Alexa                         #
#               Smart Home Speakers                #
#             Powered by Haaska Skill              #
####################################################
#### API ALEXA ###
api:
 alexa:
   smart_home:

####################################################
#                    Alexa                         #
#               Smart Home Speakers                #
#             Powered by Haaska Skill              #
####################################################
### URL https://github.com/mike-grant/haaska/wiki
alexa:
  smart_home:
    # endpoint: https://api.eu.amazonalexa.com/v3/events
    # client_id: !secret alexa_client_id
    # client_secret: !secret alexa_client_secret
    filter:
      include_entities:
        #- group.all_lights
        #- group.all
        #- light.kitchen_white
        #- light.living_door_rgb
        #- light.living_sofa_rgb
        #- light.living_window_white
        #- light.room_nico_rgb
        - switch.air
        - switch.air2
        - switch.air3
        - switch.dsm01
        #- switch.fritz_dect_200_1
        #- switch.fritz_dect_200_2
        - switch.nico_computer
        #- sensor.miflora_1_temperature
        #- media_player.sony_bravia_tv
        #- sensor.bathroom_temperature
        #- sensor.bedroom_temperature
        #- sensor.living_room_temperature
        - media_player.tv_casetta
        #- cover.shelly_shsw_25_e6704f
      include_domains:
        #- switch
        #- light
        #- script
        #- alarm_control_panel
        #- climate
        - media_player
      exclude_entities:
        #- switch.foscam_state
        #- switch.foscam_motion
        - media_player.nicolo_s_alexa_apps
        - media_player.nicolo_s_bose_home_speaker_500
        - media_player.this_device
        - media_player.echo_dot_di_nicolo
        - media_player.this_device_2
        - media_player.salotto
        - media_player.kd_55xf9005
        - switch.fluxer
        - climate.living_room
        - climate.bathroom
        - climate.living_room
        - sensor.bathroom_temperature
        - sensor.bedroom_temperature
        - sensor.living_room_temperature
      exclude_domains:
        - automation
        - automation
        - group
        - lock
        - cover
        - alert
        - switch
        - script
        - light
        - climate
        #- media_player

    entity_config:
      #light.kitchen_white:
        #name: Luce Cucina
        #description: La Luce in Cucina
        #display_categories: LIGHT
      #light.living_door_rgb:
        #name: Luce Salone
        #description: la luce del Salone
        #display_categories: LIGHT 
      #light.living_sofa_rgb:
        #name: Luce Divano
        #description: la Luce del divano
        #display_categories: LIGHT
      #light.living_window_white:
        #name: Luce Finestra Salone
        #description: la luce vicino la Finestra del salone
        #display_categories: LIGHT
      #light.room_nico_rgb:
        #name: Luce Camera Nico
        #description: La Luce della stanza di Nico
        #display_categories: LIGHT
      switch.nico_computer:
        name: il PC
        description: Computer
        display_categories: SWITCH
      switch.dsm01:
        name: Synology
        description: Il Nas
        display_categories: SWITCH
      #group.all_lights:
        #name: Tutte le luci
        #description: Tutte le luci
      #group.all:
        #name: Tutto
        #description: Tutto
        #display_categories: SWITCH
      media_player.tv_casetta:
        name: la TV
        description: il televisore
        #display_categories: SWITCH
      #media_player.sony_bravia_tv:
        #name: TV Mamma
        #description: La televisione di Mamma
        #display_categories: SWITCH
      switch.air:
        name: Aria Fredda
        description: l'aria fredda
        display_categories: SWITCH
      switch.air2:
        name: Deumidificatore 
        description: il deumidificatore
        display_categories: SWITCH
      switch.air3:
        name: Aria calda
        description: l'aria calda
        display_categories: SWITCH
      # switch.presa_pc_fritz_dect_200_1:
      #   name: Ciabatta Rack
      #   description: La Ciabatta Rack
      #   display_categories: SWITCH
      # switch.presa_rasp_pi3_fritz_dect_200_2:
      #   name: Presa Raspberry
      #   description: La presa del raspberry
      #   display_categories: SWITCH
      #cover.shelly_shsw_25_e6704f:
        #name: Serranda Salone
        #description: la serranda del salone
        #display_categories: SWITCH


####################################################
#                                                  #
#                    Wake on LAN                   #
#                                                  #
####################################################
# https://www.home-assistant.io/integrations/wake_on_lan/

wake_on_lan:

####################################################
#                                                  #
#                      Google                      #
#                     Calendar                     #
####################################################
# https://www.home-assistant.io/integrations/calendar.google/

google:
  client_id: !secret google_clientid
  client_secret: !secret google_secret


####################################################
#                                                  #
#                      Alarm                       #
#                      Panel                       #
####################################################
# https://www.home-assistant.io/integrations/manual/

alarm_control_panel:
  - platform: manual
    name: Home Alarm
    code: '1234'
    arming_time: 30
    delay_time: 20
    trigger_time: 4
    disarmed:
      trigger_time: 0
    armed_home:
      arming_time: 0
      delay_time: 0

================================================
FILE: cover.yaml
================================================
- platform: mqtt
  name: "Serranda Salone"    
  command_topic: "shellies/shellyswitch25-abcd1234/roller/0/command" 
  position_topic: "shellies/shellyswitch25-abcd1234/roller/0/pos"
  set_position_topic: "shellies/shellyswitch25-abcd1234/roller/0/command/pos"
  availability_topic: "shellies/shellyswitch25-abcd1234/online"
  #state_topic: "shellies/shellyswitch25-abcd1234/roller/0"
  payload_available: "true"
  payload_not_available: "false"
  qos: 1
  retain: false
  optimistic: false
  payload_open: "open"
  payload_close: "close"
  payload_stop: "stop"
  position_open: 100
  position_closed: 0


================================================
FILE: customize.yaml
================================================
####################################################
#                                                  #
#               CUSTOMIZE DEVICES                  #
#                                                  #
####################################################
      switch.mypc:
        icon: mdi:laptop-windows
      device_tracker.fritzbox:
        icon: mdi:router-wireless
      device_tracker.mysgs6:
        icon: mdi:cellphone-android
      device_tracker.mypc:
        icon: mdi:laptop-windows
      device_tracker.personsgs3:
        icon: mdi:cellphone-android
    device_tracker.wkmob021:
        icon: mdi:laptop-windows
    device_tracker.dsm01:
        icon: mdi:server-network

####################################################
#                                                  #
#            CUSTOMIZE MEDIA PLAYERS            #
#                                                  #
####################################################


####################################################
#                                                  #
#             CUSTOMIZE SWITCHES                  #
#                                                  #
####################################################

 ####MEDIA####

 ####LIGHTS####

####################################################
#                                                  #
#             CUSTOMIZE SENSORS                  #
#                                                  #
####################################################
 ####WEATHER####
   sensor.owm_condition:
       icon: mdi:weather-sunny
 sensor.owm_cloud_coverage:
       icon: mdi:weather-cloudy
 sensor.owm_rain:
       icon: mdi:weather-rainy
 sensor.owm_humidity:
       icon: mdi:water-percent
 sensor.owm_pressure:
       icon: mdi:nest-thermostat
 sensor.owm_snow:
       icon: mdi:weather-snowy
 sensor.owm_wind_speed:
       icon: mdi:weather-windy

####MQTT BATTERY####
     sensor.batteria_telefono_my:
        icon: mdi:battery
     sensor.batteria_telefono_person:
        icon: mdi:battery

####MISC####
     speedtest_download:
        icon: mdi:download
     sensor.speedtest_upload:
        icon: mdi:upload
     sensor.speedtest_ping:
        icon: mdi:speedometer
     sensor.fastcom_download:
        icon: mdi:download

####################################################
#                                                  #
#             CUSTOMIZE SCRIPTS                  #
#                                                  #
####################################################


####################################################
#                                                  #
#             CUSTOMIZE SCENES                  #
#                                                  #
####################################################


================================================
FILE: device_tracker.yaml
================================================
- platform: fritz
  host: 10.10.10.1
  username: !secret fritz_user
  password: !secret fritz_pwd

- platform: fritz
  host: 10.10.20.1
  username: !secret fritz_user
  password: !secret fritz_pwd

- platform: owntracks
  max_gps_accuracy: 200

- platform: mqtt
  devices:
     Nico_SGS6: /location/Nico
     Mamma-SGS3: /location/mamma

- platform: nmap_tracker
  hosts: 
    - 10.10.10.0/24
    - 10.0.20.0/24  
  home_interval: 10


================================================
FILE: google.yaml
================================================
client_id: !secret google_clientid
client_secret: !secret google_secret

================================================
FILE: groups.yaml
================================================


############################################################
#                                                          #
#                  Entities Groups                         #
#                                                          #
############################################################

Family:
    entities:
    - device_tracker.iphone
    - device_tracker.nicogalaxys8
    #owntracks
    #- device_tracker.nico_nico  


Lights:
    entities:
    - switch.shelly_shsw_25_68796e_1
    - switch.shelly_shsw_25_68796e_2
    - switch.shelly_shsw_25_686d62_1
    - switch.shelly_shsw_25_686d62_2
    - switch.shelly_shsw_25_687269_1
    - switch.shelly_shsw_25_687269_2
    - switch.shelly_shsw_25_e5e601_1
    - switch.shelly_shsw_25_e5e601_2

Living:
    entities:
    - switch.shelly_shsw_25_68796e_1
    - switch.shelly_shsw_25_68796e_2
    #- input_slider.living_bright

Bedroom:
    entities:
    - switch.shelly_shsw_25_687269_1
    - switch.shelly_shsw_25_687269_2

Kitchen:
    entities:
    - switch.shelly_shsw_25_686d62_1
    - switch.shelly_shsw_25_686d62_2

Bathroom:
    entities:
    - switch.shelly_shsw_25_e5e601_1
    - switch.shelly_shsw_25_e5e601_2

Who Cook:
  entities:
    - input_select.who_cooks


================================================
FILE: input_boolean/trigger_booleans.yaml
================================================
#triggers
#good_night:
  #name: Good Night
  #initial: off

#good_morning:
  #name: Good Morning
  #initial: off

#meal_time:
  #name: Meal Time
  #initial: off

tv_time:
  name: TV Time
  initial: off

#work:
  #name: Work
  #initial: off

#flash:
  #name: Flash
  #initial: off



================================================
FILE: input_select/ac_mode.yaml
================================================
ac_mode:
  name: AC Mode Morning
  options:
    - Power Off
    - Hot
    - Hot Morning
    - Cold
    - Cold Morning
    - Humidity
    - Humidity Morning
    - None
  initial: Power Off
  icon: mdi:fan

================================================
FILE: input_select/living_bright.yaml
================================================
living_bright:
  name: Living Brightness
  options:
    - Low
    - Medium
    - Max
  initial: Max
  icon: mdi:lightbulb

================================================
FILE: input_select/living_scene.yaml
================================================
living_scene:
  name: Living Scenes
  options:
    - White
    - Romantic (Red)
    - Movie (Blue)
    - Gold
    - Purple
    - Green
  initial: White
  icon: mdi:lightbulb

================================================
FILE: input_select/log_level.yaml
================================================
log_level:
  name: Log Level
  options:
    - critical
    - fatal
    - error
    - warning
    - warn
    - info
    - debug
    - notset
  initial: warn

================================================
FILE: input_select/lounge_scene.yaml
================================================
Living_scene:
  name: Living Scenes
  options:
    - White
    - Romantic (Red)
    - Movie (Blue)
    - Gold
    - Purple
    - Green
  initial: White
  icon: mdi:lightbulb

================================================
FILE: input_select/nico_room_scene.yaml
================================================
my_room_scene:
  name: my Room Scenes
  options:
    - White
    - Romantic (Red)
    - Movie (Blue)
    - Gold
    - Purple
    - Green
  initial: White
  icon: mdi:lightbulb

================================================
FILE: input_select/pc_power_options.yaml
================================================
pcoptions:
  name: PC Power Options
  options:
    - Restart
    - Shutdown
    - None
    - Sleep
    - Hibernate
  initial: None
  icon: mdi:desktop-tower

================================================
FILE: input_select/who_cook.yaml
================================================
who_cooks:
  name: Who cooks today
  options:
    - my
    - Rossella
    - gf
  initial: Rossella
  icon: mdi:panda

================================================
FILE: input_slider/living_bright.yaml
================================================
living_bright:
  name: Lights Brightness
  initial: 254
  min: 0
  max: 254
  step: 1

================================================
FILE: ip_bans.yaml
================================================



================================================
FILE: light.yaml
================================================
  - platform: yeelight
    devices:
      10.10.10.239:
        name: Living - Sofa - RGB
        #transition: 1000
        use_music_mode: True
        #save_on_change: False  
      10.10.10.218:
        name: Living - Door - RGB
        #transition: 1000
        use_music_mode: True
        #save_on_change: False
      10.10.10.219:
        name: Living - Window - White
      10.10.10.216:
        name: Room - my - RGB
        transition: 3000
        use_music_mode: True
        #save_on_change: False
      10.10.10.213:
        name: Kitchen - White


================================================
FILE: media_player.yaml
================================================
#- platform: cast
  #host: 10.10.10.215
- platform: braviatv
  host: 10.10.10.215
- platform: kodi
  host: 10.10.10.215

================================================
FILE: mqtt.yaml
================================================

### MOSQUITTO ON HASSIO ###
broker: !secret mqtt_broker
username: !secret mqtt_hassio_user
password: !secret mqtt_hassio_pwd
discovery: true
discovery_prefix: !secret discoveryprefix



================================================
FILE: notify.yaml
================================================
- name: hassnico_bot
  platform: telegram
  api_key: !secret telegram_apikey
  chat_id: !secret telegram_clientid

- platform: alexa_media
  name: alexa_media

================================================
FILE: panel_custom.yaml
================================================
  - name: react
    sidebar_title: Panel Switch
    sidebar_icon: mdi:settings
    url_path: todomvc
    config:
      title: Panel


================================================
FILE: scene/TV_Time.yaml
================================================
- name: TV Time
  entities:
       light.Living__sofa__rgb:
           state: on
           color_name: 'darkblue'
           brightness: 255
       light.Living__window__white:
           state: off
       light.Living__door__rgb:
           state: on
           color_name: 'darkblue'
           brightness: 255

================================================
FILE: scene/TV_Time_off.yaml
================================================
- name: TV Time
  entities:
       light.Living__sofa__rgb:
           state: on
           color_name: 'white'
           brightness: 255
       light.Living__window__white:
           state: on
       light.Living__door__rgb:
           state: on
           color_name: 'white'
           brightness: 255

================================================
FILE: scene/living.yaml
================================================
- name: White - Living
  entities:
    light.Living__sofa__rgb:
      state: on
      color_name: 'white'
      brightness: 255
    light.Living__window__white:
      state: on
      brightness: 255
    light.Living__door__rgb:
      state: on
      color_name: 'white'
      brightness: 255

- name: Green - Living
  entities:
    light.Living__sofa__rgb:
      state: on
      color_name: 'forestgreen'
      brightness: 255
    light.Living__window__white:
      state: off
    light.Living__door__rgb:
      state: on
      color_name: 'green'
      brightness: 255

- name: Movies - Living
  entities:
    light.Living__sofa__rgb:
      state: on
      color_name: 'blue'
      brightness: 255
    light.Living__window__white:
      state: off
    light.Living__door__rgb:
      state: on
      color_name: 'blue'
      brightness: 255

- name: Romantic - Living
  entities:
    light.Living__sofa__rgb:
      state: on
      color_name: red
      brightness: 255
    light.Living__window__white:
      state: off
      #rgb_color: [220, 20, 60]
      #brightness: 255
    light.Living__door__rgb:
      state: on
      color_name: red
      brightness: 255

- name: Purple - Living
  entities:
    light.Living__sofa__rgb:
      state: on
      color_name: 'purple'
      brightness: 255
    light.Living__window__white:
      state: off
    light.Living__door__rgb:
      state: on
      color_name: 'purple'
      brightness: 255

- name: Gold - Living
  entities:
    light.Living__sofa__rgb:
      state: on
      color_name: 'gold'
      brightness: 255
    light.Living__window__white:
      state: off
    light.Living__door__rgb:
      state: on
      color_name: 'gold'
      brightness: 255


================================================
FILE: scene/living_lights_off.yaml
================================================
- name: Lights OFF - Living
  entities:
    light.Living__sofa__rgb:
      state: off
    light.Living__window__white:
      state: off
    light.Living__door__rgb:
      state: off


================================================
FILE: scene/living_lights_on.yaml
================================================
- name: Lights ON - Living
  entities:
    light.Living__sofa__rgb:
      state: on
      rgb_color: [255, 255, 255]
      brightness: 255
    light.Living__window__white:
      state: on
      brightness: 255
    light.Living__door__rgb:
      state: on
      rgb_color: [255, 255, 255]
      brightness: 255


================================================
FILE: scene/monthly_colors.yaml
================================================
- name: month_standard_colors
  entities:
       light.room__my__rgb:
           state: 'on'
           color_name: 'Gold'

- name: month_valentine_colors
  entities:
       light.room__my__rgb:
           state: 'on'
           color_name: 'Crimson'

- name: month_st_patty_colors
  entities:
       light.room__my__rgb:
           state: 'on'
           #color_name: 'Dark Spring Green'
           rgb_color: [23,114,69]

############## OUTDOR LIGHTS - TO DO ############

#- name: month_RWB_colors
  #entities:
       #light.outdoor_foyer:
           #state: 'on'
           ##color_name: 'Cream'
           #rgb_color: [255,253,208]
           #brightness: 30
       #light.outdoor_sconce_3:
           #state: 'on'
           #color_name: 'Red'
       #light.outdoor_sconce_2:
           #state: 'on'
           ##color_name: 'White' Smoke
           #rgb_color: [245,245,245]
       #light.outdoor_sconce_1:
           #state: 'on'
           #color_name: 'Blue'

#- name: front_full_brightness
  #entities:
       #light.room__my__rgb:
           #state: 'on'
           #color_name: 'White'
           #brightness: 250
#- name: month_marti_gras_colors
  #entities:
       #light.outdoor_foyer:
           #state: 'on'
           #color_name: 'Gold'
       #light.outdoor_sconce_1:
           #state: 'on'
           #color_name: 'Purple'
       #light.outdoor_sconce_2:
           #state: 'on'
           #color_name: 'Green'
       #light.outdoor_sconce_3:
           #state: 'on'
           #color_name: 'Gold'

================================================
FILE: scene/movies.yaml
================================================
- name: Movies - Living
  entities:
    light.Living__sofa__rgb:
      state: on
      color_name: 'blue'
      brightness: 120
    light.Living__window__white:
      state: off
    light.Living__door__rgb:
      state: on
      color_name: 'blue'
      brightness: 120


================================================
FILE: scene/my_room.yaml
================================================
- name: White - my
  entities:
    light.room__my__rgb:
      state: on
      color_name: 'white'
      brightness: 255

- name: Green - my
  entities:
    light.room__my__rgb:
      state: on
      color_name: 'green'
      brightness: 255

- name: Movies - my
  entities:
    light.room__my__rgb:
      state: on
      color_name: 'blue'
      brightness: 255


- name: Romantic - my
  entities:
    light.room__my__rgb:
      state: on
      color_name: red
      brightness: 255


- name: Purple - my
  entities:
    light.room__my__rgb:
      state: on
      color_name: 'purple'
      brightness: 255

- name: Gold - my
  entities:
    light.room__my__rgb:
      state: on
      color_name: 'gold'
      brightness: 255


================================================
FILE: scene/romantic.yaml
================================================
- name: Romantic - Living
  entities:
    light.Living__sofa__rgb:
      state: on
      color_name: red
      brightness: 255
    light.Living__window__white:
      state: off
      #rgb_color: [220, 20, 60]
      #brightness: 255
    light.Living__door__rgb:
      state: on
      color_name: red
      brightness: 255

================================================
FILE: scene/romatic_my.yaml
================================================
- name: Romantic - my
  entities:
    light.room__my__rgb:
      state: on
      color_name: red
      brightness: 200

================================================
FILE: scripts/low_battery.yaml
================================================
sequence:
- event: LOGBOOK_ENTRY
  event_data:
    name: EVENT
    message: "Low battery Event"
- service: notify.homemyassistant_bot
  data:
    message: "{% if states('sensor.batteria_telefono_my') < '25'%}Low battery detected! my's battery is at {{states('sensor.batteria_telefono_my')}}%{% else %} {% endif %} {% if states('device_tracker.2275304c') < '25'%}Low battery detected! Cailin's battery is at {{states('sensor.batteria_telefono_person')}}%{% else %} {% endif %}"


================================================
FILE: scripts/monthly_color_scene.yaml
================================================
######################################################################################################
###Script to turn on scene for the appropriate month for the front of the house but only when the sun is down. 
#  action:
#   - service: script.monthly_color_scene
#
#   scenes should be named month_[01-12]_colors (month_06_colors)
######################################################################################################

monthly_color_scene:
  sequence:
    - condition: state
      entity_id: sun.sun
      state: 'below_horizon'
    - condition: state
      entity_id: input_boolean.alert_mode
      state: 'off'
    
    - service: logbook.log
      data_template:
        name: "Launching Scene:"
        message: >
          "scene.month_
          {%- if now().strftime("%m%d")|int == 101 -%}
          new_years_day
          {%- elif now().strftime("%m%d")|int == 212
          or now().strftime("%m%d")|int == 220
          or now().strftime("%m%d")|int == 520
          or now().strftime("%m%d")|int == 529
          or now().strftime("%m%d")|int == 614
          or now().strftime("%m%d")|int == 704
          or now().strftime("%m%d")|int == 904
          or now().strftime("%m%d")|int == 911
          or now().strftime("%m%d")|int == 1111
          -%}
          RWB
          {%- elif now().strftime("%m%d")|int >= 210 
          and now().strftime("%m%d")|int <= 214-%}
          valentine
          {%- elif now().strftime("%m%d")|int == 228 -%}
          marti_gras
          {%- elif now().strftime("%m%d")|int >= 314 
          and now().strftime("%m%d")|int <= 317-%}
          st_patty
          {%- else -%}
          standard
          {%- endif -%}_colors"
          
    - service: scene.turn_on
      data_template:
        entity_id: >
          scene.month_
          {%- if now().strftime("%m%d")|int == 101 -%}
          new_years_day
          {%- elif now().strftime("%m%d")|int == 212
          or now().strftime("%m%d")|int == 220
          or now().strftime("%m%d")|int == 520
          or now().strftime("%m%d")|int == 529
          or now().strftime("%m%d")|int == 614
          or now().strftime("%m%d")|int == 704
          or now().strftime("%m%d")|int == 904
          or now().strftime("%m%d")|int == 911
          or now().strftime("%m%d")|int == 1111
          -%}
          RWB
          {%- elif now().strftime("%m%d")|int >= 210 
          and now().strftime("%m%d")|int <= 214-%}
          valentine
          {%- elif now().strftime("%m%d")|int == 228 -%}
          marti_gras
          {%- elif now().strftime("%m%d")|int >= 314 
          and now().strftime("%m%d")|int <= 317-%}
          st_patty
          {%- else -%}
          standard
          {%- endif -%}_colors
 
 
# http://www.calendar-365.com/holidays/2017.html 
# 101 New_years_day (colorloop)
# RWB 212 Lincoln's Birthday
# 214 Valentine's Day (pink, red) 
# RWB 220 President's Day
# 228 Mardi Gras (purple, green, gold )
# 317 st Patty (green)
# 414 Good Friday
# 416 Easter
# 422 Earth Day
# 505 Cinco de Mayo
# 514 Mother's Day
# RWB 520 Armed Forces Day
# RWB 529 Memorial Day
# RWB 614 Flag Day
# 618 Fathers day
# RWB 704 July 4th
# RWB 904 Labor Day
# RWB 911 Patriots day
# 1009 columbus day
# 1031 halloween
# RWB 1111 veterans day
# 1123 Thanksgiving
# 1212 Hanukkah start 8 days.
# 1225 Chrismas
# 1231 New years eve

================================================
FILE: scripts/refresh_devices.yaml
================================================
sequence:
- service: mqtt.publish
  data:
    topic: "owntracks/my/my/cmd"
    payload_template: '{"_type":"cmd","action":"reportLocation"}'
- service: mqtt.publish
  data:
    topic: "owntracks/person/person/cmd"
    payload_template: '{"_type":"cmd","action":"reportLocation"}'


================================================
FILE: scripts/restart_ha.yaml
================================================
sequence:
- event: LOGBOOK_ENTRY
  event_data:
    name: EVENT
    message: "Restarting Home Assistant"
- service: notify.homemyassistant_bot
  data:
    message: "Restarting Home Assistant at {{ states('sensor.date__time') }}"
- service: homeassistant.restart


================================================
FILE: scripts/scene_notify.yaml
================================================
  sequence:
    - condition: and
      conditions:
        - condition: or
          conditions:
            - condition: state
              entity_id: group.scenes
              state: 'on'

    - service: notify.homemyassistant_bot
      data:
        message: " {{ trigger.entity_id }} is activated "

================================================
FILE: scripts/sunrise.yaml
================================================
sequence:
- event: LOGBOOK_ENTRY
  event_data:
    name: EVENT
    message: "SUNRISE"
- service: notify.homemyassistant_bot
  data:
    message: "The sun is up! Good Morning! {{ states('sensor.date__time') }} "


================================================
FILE: scripts/sunset.yaml
================================================
sequence:
- event: LOGBOOK_ENTRY
  event_data:
    name: EVENT
    message: "SUNSET"
- service: notify.homemyassistant_bot
  data:
    message: "The sun is setting. Woow Beautiful! {{ states('sensor.date__time') }}"


================================================
FILE: scripts/voice_notify.yaml
================================================
  sequence:
    - condition: and
      conditions:
        - condition: or
          conditions:
            - condition: state
              entity_id: group.family
              state: 'home'
        - condition: or
          conditions:
            - condition: time
              after: '09:00:00'
              before: '22:00:00'

    - service: media_player.turn_on
      entity_id: media_player.kd55xd9305

    #- service: media_player.volume_set
      #entity_id:
        #- media_player.kd55xd9305
      #data_template:
        #volume_level: >
          #{% if now().strftime("%H")|int < 12 and now().strftime("%H")|int > 6%}
          #0.25
          #{% elif now().strftime("%H")|int > 12 and now().strftime("%H")|int < 17%}
          #0.45
          #{% else %}
          #0.20
          #{% endif %}

    - service: tts.google_say
      entity_id: media_player.kd55xd9305
      data_template:
        message: >
          {% if now().strftime("%H")|int < 12 and now().strftime("%H")|int > 6%}
          "Good morning.
          {% elif now().strftime("%H")|int > 12 and now().strftime("%H")|int < 17%}
          "Good afternoon.
          {% else %}
          "Good evening.
          {% endif %}
        cache: true

================================================
FILE: scripts.yaml
================================================
####ALARM ####

####TEST SCRIPTS####

####GLOBAL SCRIPTS####

####TRIGGERED LIGHTS

####NOTIFICATIONS AND ALERTS####
####################################################
#                                                  #
#             Let's Encrypt Renewal                #
#                                                  #
####################################################
  letsencrypt_renewal:
   alias: "Let's Encrypt Renewal"
   sequence:
     - service: hassio.addon_restart
       data:
        addon: core_letsencrypt
     - service: notify.hassnico_bot
       data:
        message: >
           "Let's Encrypt CA was Renewed with Script"
        
####################################################
#                                                  #
#                   OWNTRACKS                      #
#                                                  #
####################################################
  owntracks_update:
   alias: Owntracks Update
   sequence:
     - service: mqtt.publish
       data:
         topic: "owntracks/Nico/Nico/cmd"
         payload_template: '{"_type":"cmd","action":"reportLocation"}'       
     - service: mqtt.publish
       data:
         topic: "owntracks/mamma/mamma/cmd"
         payload_template: '{"_type":"cmd","action":"reportLocation"}'

####################################################
#                                                  #
#                   Telegram                       #
#                                                  #
####################################################
  nico_gps_notify_telegram:    
   alias: Script for Notify Nico's Location on Telegram
   sequence:
     - service: telegram_bot.send_location
       data:
         caption: 'Nico location'
         target:
           - !secret telegram_clientid
           - !secret telegram_clientid2
         latitude: '{{ states.device_tracker.nico_nico.attributes.latitude|float }}'
         longitude: '{{ states.device_tracker.nico_nico.attributes.longitude|float }}'
         disable_notification: true

  mamma_gps_notify_telegram: 
   alias: Script for Notify Mom's Location on Telegram
   sequence:
     - service: telegram_bot.send_location
       data:
         caption: 'Mom location'
         target:
           - !secret telegram_clientid
           - !secret telegram_clientid2
         latitude: '{{ states.device_tracker.mamma_mamma.attributes.latitude|float }}'
         longitude: '{{ states.device_tracker.mamma_mamma.attributes.longitude|float }}'
         disable_notification: true


####################################################
#                                                  #
#                    Alexa                         #
#                                                  #
####################################################
  alexascripthastart:
    sequence:
    - service: media_player.volume_set
      data:
        entity_id: media_player.nicolo_s_bose_home_speaker_500
        volume_level: 0.2
    - delay: 00:00:02    
    - service: notify.alexa_media
      data:
        target: 
          - media_player.nicolo_s_bose_home_speaker_500
        data:
          type: tts
        message: >
         {{ [
         "Home Assistant è nuovamente disponibile",
         "Home Assistant è operativo",
         "Home assistant is back bitches",
         "Home assistant è avviato",
         ] | random }}

  alexascriptvoipcall:
    sequence:
    - service: media_player.volume_set
      data:
        entity_id: media_player.echo_dot_di_nicolo
        volume_level: 0.5
    - delay: 00:00:02
    - service: notify.alexa_media
      data:
        target: media_player.echo_dot_di_nicolo
        data:
          type: tts
        message: "Prova di Nico"
    - service: hassio.addon_stdin
      data_template:
        addon: 89275b70_dss_voip
        input: {"call_sip_uri":"sip:+393402703738@sip.voipcheap.com","message_tts":"Telefonata VoIP di Prova da Nico"}

  alexascriptmariatiamo:
    sequence:
    - service: media_player.volume_set
      data:
        entity_id: media_player.nicolo_s_bose_home_speaker_500
        volume_level: 0.2
    #- delay: 00:00:01
    - service: notify.alexa_media
      data:
        target: 
          - media_player.nicolo_s_bose_home_speaker_500
        data:
          type: tts
        message: "Maria ti amo"

  alexascriptvoiptest:
    sequence:
    - service: hassio.addon_stdin
      data_template:
        addon: 89275b70_dss_voip
        input: {"call_sip_uri":"sip:+393402703738@sip.voipcheap.com","message_tts":"Telefonata VoIP di Prova da Nico"}

  alexascriptbirthday:
    sequence:
      - service: notify.alexa_media
        data:
          target: 
            - media_player.nicolo_s_bose_home_speaker_500
          data:
            type: tts
          message: > 
           {{- [
           "Celebrate your birthday today. Celebrate being Happy every day.",
           "Well, you are another year older and you haven't changed a bit. That's great because you are perfect just the way you are. Happy Birthday.",
           "You are special and I hope that you float through the day with a big smile on your face. Happy Birthday!",
           "Happy Birthday!!! I hope this is the begining of your greatest, most wonderful year ever!",
           "Wishing you a day that is as special in every way as you are. Happy Birthday.",
           "You have to get older, but you don't have to grow up!",
           "Set the world on fire with your dreams and use the flame to light a birthday candle. HAPPY BIRTHDAY!",
           "Thinking of you on your birthday, and wishing you all the best! I hope it is as fantastic as you are, you deserve the best and nothing less.",
           "I hope that you have the greatest birthday ever from the moment you open your eyes in the morning until they close late at night.",
           "Hope your birthday is totally cool, really funtastic, wonderful, exciting, majorly awesome, rocking and HAPPY. Happy Birthday wishes.",
           "Be your own light. Find your own way. It should be easy with all those candles.",
           "Your birthday should be a national holiday. I need a day off. Happy Birthday.",
           "You are a gift to the world. How is that for a reverse birthday wish. Happy Birthday.",
           "I hope that today is the beginning of a great year for you. Happy Birthday.",
           "Happy Birthday !! Have a wonderful happy, healthy birthday and many more to come.",
           "I hope you have a beautiful day and get at least half of what you want! Happy Birthday!",
           "Happy Birthday. Just one more year and you will be perfect. Yes, I did say that last year.",
           "You have a birthday twinkle in your eye so have fun and know we love you fairy, fairy much. Happy Birthday.",
           "Live today like it is a special gift, because it is the best birthday gift. Happy Birthday.",
           "May your heart naturally beat with the happiness and laughter that you give others. Happy Birthday.",
           "Happy Birthday. Hope it's one of the best ever!!!!... a lovely birthday for a lovely person!",
           "Wishing you health, love, wealth, happiness and just everything your heart desires. Happy Birthday.",
           "Happy Birthday to a friend who means more to me than chocolate.",
           "Things I like about you: humor, looks, everything. Happy Birthday.",
           "Watch out world. You are old enough to know what to do and how to do it. Happy Birthday.",
           "When I paint my masterpiece, I am pretty sure there will be a spot for you. Happy Birthday.",
           "Happy Birthday. I hope that you will have a truly marvelous and joyous day with family and friends.",
           "Enjoy your birthday and every day to the fullest. A Happy Birthday is just part of a Happy Life.",
           "No matter how hard you try to fit in, you were born to stand out. Now celebrate that fact.",
           "Hope your day is simply terrific! Happy Birthday.",
           "I wish you a wonderfulBirthday!! I hope you have an amazing day and lots of fun! Enjoy this day, you deserve it!",
           "Time waits for no one but that doesn't matter if you don't wait for it! Happy Birthday.",
           "Today is not the end of another year, but the start of a new one. Happy Birthday.",
           "Being young is a privilege. Being attractive a genetic gift. Being cool, that is all you. Happy Birthday.",
           "Wishing you love and happiness on your birthday. Happy Birthday",
           "You aren't getting older, you are getting better. Happy Birthday.",
           "May your day be beautiful and may your heart be happy and may you celebrate birthdays for many years to come.",
           "I wish you happiness, health and so many good things in your life. Happy Birthday!",
           "Work hard. Play hard. Eat lots of cake. That's a good motto for your birthday and for life.",
           "I wish you happiness, health and so many good things in your life. Happy Birthday!",
           "What should we celebrate first: your accomplishments or your birthday?",
           "Out of the 19,178,082 people having a birthday today, you rank solidly in my top 10 list.",
           "Happy Birthday to a lovely & vibrant individual!",
           "You remind me of you at your age. Young and good looking! Happy Birthday!",
           "I wish you the best birthday ever! I hope you get lots of kisses and hugs. Happy Birthday!",
           "Hope you have wonderful birthday filled with fun, excitement and joy. Happy Birthday.",
           "I hope your BIG BRIGHT STAR keeps on shining. HAPPY BIRTHDAY !",
           "Happy Birthday. Hope it's one of the best ever!!! A lovely birthday for a lovely person!",
           "Happy moments. Happy thoughts. Happy Dreams. Happy feelings. Happy Birthday.",
           "Happy Birthday to you!, Happy Birthday to you!, Happy Birthday to you!"
           ] | random -}}

  alexamediapause2:
    sequence:
    - data:
        entity_id: media_player.salotto
      service: media_player.media_pause

  alexaradiofreccia:    
    sequence:
    - service: media_player.volume_set
      data:
        entity_id: media_player.nicolo_s_bose_home_speaker_500
        volume_level: 0.2
    - delay: 00:00:02    
    - data:
        entity_id: media_player.nicolo_s_bose_home_speaker_500
        media_content_id: "Radiofreccia"
        media_content_type: "TUNEIN"
      service: media_player.play_media

  alexalazio:    
    sequence:
    - service: media_player.volume_set
      data:
        entity_id: media_player.nicolo_s_bose_home_speaker_500
        volume_level: 0.2
    - delay: 00:00:02    
    - data:
        entity_id: media_player.nicolo_s_bose_home_speaker_500
        media_content_id: "Lazio Style Radio"
        media_content_type: "TUNEIN"
      service: media_player.play_media

  alexaglobo:    
    sequence:
    - service: media_player.volume_set
      data:
        entity_id: media_player.nicolo_s_bose_home_speaker_500
        volume_level: 0.2
    - delay: 00:00:02    
    - data:
        entity_id: media_player.nicolo_s_bose_home_speaker_500
        media_content_id: "Radio Globo"
        media_content_type: "TUNEIN"
      service: media_player.play_media

  alexartl1025:    
    sequence:
    - service: media_player.volume_set
      data:
        entity_id: media_player.nicolo_s_bose_home_speaker_500
        volume_level: 0.2
    - delay: 00:00:02    
    - data:
        entity_id: media_player.nicolo_s_bose_home_speaker_500
        media_content_id: "RTL 102.5"
        media_content_type: "TUNEIN"
      service: media_player.play_media

  alexa105:    
    sequence:
    - service: media_player.volume_set
      data:
        entity_id: media_player.nicolo_s_bose_home_speaker_500
        volume_level: 0.2
    - delay: 00:00:02    
    - data:
        entity_id: media_player.nicolo_s_bose_home_speaker_500
        media_content_id: "Radio 105"
        media_content_type: "TUNEIN"
      service: media_player.play_media

  alexards:    
    sequence:
    - service: media_player.volume_set
      data:
        entity_id: media_player.nicolo_s_bose_home_speaker_500
        volume_level: 0.2
    - delay: 00:00:02    
    - data:
        entity_id: media_player.nicolo_s_bose_home_speaker_500
        media_content_id: "RDS Radio"
        media_content_type: "TUNEIN"
      service: media_player.play_media

  alexam2o:    
    sequence:
    - service: media_player.volume_set
      data:
        entity_id: media_player.nicolo_s_bose_home_speaker_500
        volume_level: 0.2
    - delay: 00:00:02    
    - data:
        entity_id: media_player.nicolo_s_bose_home_speaker_500
        media_content_id: "m2o"
        media_content_type: "TUNEIN"
      service: media_player.play_media

  alexaflash:    
    sequence:
    - service: media_player.volume_set
      data:
        entity_id: media_player.nicolo_s_bose_home_speaker_500
        volume_level: 0.2
    - delay: 00:00:02    
    - data:
        entity_id: media_player.nicolo_s_bose_home_speaker_500
        media_content_id: Alexa.FlashBriefing.Play
        media_content_type: sequence
      service: media_player.play_media

  alexaimathome:    
    sequence:
    - service: media_player.volume_set
      data:
        entity_id: media_player.nicolo_s_bose_home_speaker_500
        volume_level: 0.2
    - delay: 00:00:02    
    - data:
        entity_id: media_player.nicolo_s_bose_home_speaker_500
        media_content_id: Alexa.ImHome.Play
        media_content_type: sequence
      service: media_player.play_media

  alexafun:    
    sequence:
    - service: media_player.volume_set
      data:
        entity_id: media_player.nicolo_s_bose_home_speaker_500
        volume_level: 0.2
    - delay: 00:00:02    
    - data:
        entity_id: media_player.nicolo_s_bose_home_speaker_500
        media_content_id: Alexa.FunFact.Play
        media_content_type: sequence
      service: media_player.play_media

  alexastory:    
    sequence:
    - service: media_player.volume_set
      data:
        entity_id: media_player.nicolo_s_bose_home_speaker_500
        volume_level: 0.2
    - delay: 00:00:02    
    - data:
        entity_id: media_player.nicolo_s_bose_home_speaker_500
        media_content_id: Alexa.TellStory.Play
        media_content_type: sequence
      service: media_player.play_media

  alexasing:    
    sequence:
    - service: media_player.volume_set
      data:
        entity_id: media_player.nicolo_s_bose_home_speaker_500
        volume_level: 0.2
    - delay: 00:00:02    
    - data:
        entity_id: media_player.nicolo_s_bose_home_speaker_500
        media_content_id: Alexa.SingASong.Play
        media_content_type: sequence
      service: media_player.play_media


  alexanight:    
    sequence:
    - service: media_player.volume_set
      data:
        entity_id: media_player.nicolo_s_bose_home_speaker_500
        volume_level: 0.2
    - delay: 00:00:02    
    - data:
        entity_id: media_player.nicolo_s_bose_home_speaker_500
        media_content_id: Alexa.GoodNight.Play
        media_content_type: sequence
      service: media_player.play_media

  alexamorning:    
    sequence:
    - service: media_player.volume_set
      data:
        entity_id: media_player.nicolo_s_bose_home_speaker_500
        volume_level: 0.2
    - delay: 00:00:02    
    - data:
        entity_id: media_player.nicolo_s_bose_home_speaker_500
        media_content_id: Alexa.GoodMorning.Play
        media_content_type: sequence
      service: media_player.play_media

  alexatraffic:    
    sequence:
    - service: media_player.volume_set
      data:
        entity_id: media_player.nicolo_s_bose_home_speaker_500
        volume_level: 0.2
    - delay: 00:00:02    
    - data:
        entity_id: media_player.nicolo_s_bose_home_speaker_500
        media_content_id: Alexa.Traffic.Play
        media_content_type: sequence
      service: media_player.play_media

  alexatraffic2:    
    sequence:
    #- service: media_player.volume_set
      #data:
        #entity_id: media_player.this_device
        #volume_level: 0.2
    #- delay: 00:00:02    
    - data:
        entity_id: media_player.this_device
        media_content_id: Alexa.Traffic.Play
        media_content_type: sequence
      service: media_player.play_media

  alexaweather:    
    sequence:
    - service: media_player.volume_set
      data:
        entity_id: media_player.nicolo_s_bose_home_speaker_500
        volume_level: 0.2
    - delay: 00:00:02    
    - data:
        entity_id: media_player.nicolo_s_bose_home_speaker_500
        media_content_id: Alexa.Weather.Play
        media_content_type: sequence
      service: media_player.play_media

  braviascript:
    sequence:
    - service: media_player.volume_set
      data_template:
        entity_id: media_player.tv_casetta_kd_55xf9005
        volume_level: 1
    - delay: 00:00:01
    - service: notify.alexa_media
      data_template:
        message: 'Ding-dong. Someone is at the door.'
        target: media_player.tv_casetta_kd_55xf9005
        data:
          type: tts


  alexa_set_volume:
    sequence:
      - service: media_player.volume_set
        data_template: 
          entity_id: '{{ states.sensor.last_alexa.state }}' 
          volume_level: >
            {% if is_state("sensor.last_alexa", "media_player.echo_dot_di_nicolo") %}
              0.5
            {% else %}
              0.3
            {% endif %} 

  alexa_tts:
    sequence:
      - service: script.turn_on
        entity_id: script.alexa_set_volume
      - delay: '00:00:01'      
      - service: media_player.alexa_tts
        data_template:
          entity_id: '{{ states.sensor.last_alexa.state }}' 
          message: "Test da Nico"

####################################################
#                                                  #
#                   Greetings                      #
#                                                  #
####################################################

  jarvis_greeting:  
   alias: Jarvis Greeting
   sequence:
     - service: media_player.volume_set
       data:
         entity_id: media_player.nicolos_bose_home_speaker_500
         volume_level: 0.3
     - delay: 00:00:01
     - service: notify.alexa_media
       data_template:
         entity_id: media_player.nicolos_bose_home_speaker_500
         message: >
           {% if now().strftime("%H")|int < 12 %}
           Buongiorno da Jarvis
           {% elif now().strftime("%H")|int < 18 %}
           Buon Pomeriggio da Jarvis
           {% else %}
           Buonasera da Jarvis
           {% endif %}
           Il tempo è {{states.sensor.owm_condition.state}} e la temperatura è di {{states.sensor.owm_temperature.state}} Centigradi a Roma. Ti auguro una buona giornata.
  
     #- service: media_player.turn_off
       #entity_id: media_player.nicolos_bose_home_speaker_500

####################################################
#                                                  #
#                    CAMERA                        #
#                                                  #
####################################################

  camera_snapshot:
   alias: Camera Snapshot
   sequence:
     - service: telegram_bot.send_photo
       data:
         caption: 'Camera Snapshot'
         target:
           - !secret telegram_clientid
          # - !secret telegram_clientid2
         url: !secret ss_camera_snapshot
        

####################################################
#                                                  #
#                  HA Service                      #
#                                                  #
####################################################

  restart_ha:
    alias: Restart HomeAssistant
    sequence:
      - alias: Restart HA
        service: homeassistant.restart

  reload_automations:
    alias: Reload Automations
    sequence:
      - alias: Reload-Automations
        service: automation.reload

####################################################
#                                                  #
#                     Shelly                       #
#                                                  #
####################################################




####################################################
#                                                  #
#                Camera presets                    #
#                                                  #
####################################################

  ss_preset_home:
    alias: Home
    sequence:
      - service: rest_command.ss_preset_home
      ### return to home preset after 30 seconds ###
      - delay: 
          seconds: 30
      - service: rest_command.ss_preset_home

  ss_preset_living:
    alias: Living
    sequence:
      - service: rest_command.ss_preset_living
      ### return to home preset after 30 seconds ###
      - delay: 
          seconds: 30
      - service: rest_command.ss_preset_home

  ss_preset_bedroom:
    alias: Bedroom
    sequence:
      - service: rest_command.ss_preset_bedroom
      ### return to home preset after 30 seconds ###
      - delay: 
          seconds: 30
      - service: rest_command.ss_preset_home

  ss_preset_rack:
    alias: Rack
    sequence:
      - service: rest_command.ss_preset_rack
      ### return to home preset after 30 seconds ###
      - delay: 
          seconds: 30
      - service: rest_command.ss_preset_home


================================================
FILE: sensor.yaml
================================================
- platform: dnsip

- platform: season
  type: astronomical

- platform: uptime

- platform: version

- platform: mqtt
  state_topic: "owntracks/Nico/Nico"
  name: "Batteria Telefono Nico"
  unit_of_measurement: "%"
  value_template: '{{ value_json.batt }}'

- platform: mqtt
  state_topic: "owntracks/mamma/mamma"
  name: "Batteria Telefono Mamma"
  unit_of_measurement: "%"
  value_template: '{{ value_json.batt }}'

- platform: darksky
  api_key: !secret darksky
  forecast:
    - 1
    - 2
    - 3
    - 4
    - 5
    - 6
    - 7
  monitored_conditions:
    - summary
    - icon
    - temperature
    - temperature_low
    - temperature_high
    - apparent_temperature
    - humidity
    - hourly_summary
    - daily_summary
    - precip_type
    - precip_intensity
    - precip_probability
    #- precip_accumulation
    - wind_speed
    - wind_bearing
    - pressure
    - visibility
    - ozone
    - uv_index
    - sunrise_time
    - sunset_time
  scan_interval:
    # At least one of these must be specified:
    days: 0
    hours: 1
    minutes: 0
    seconds: 0
    milliseconds: 0

- platform: template
  sensors:
    data_e_ora:
      entity_id: sensor.time
      value_template: >
        {{now().strftime("%d/%m/%Y - %H:%M")}}
      friendly_name: "Data e Ora"
      icon_template: mdi:calendar-clock
    
    dark_sky_summary_tmpl:
      friendly_name_template: Condizione
      value_template: >
        {{ states('sensor.dark_sky_summary') }}
      entity_picture_template: >-
        {{ '/local/icons/dark_sky/' ~ states.sensor.dark_sky_icon.state ~ '.png'}}
    dark_sky_hourly_summary_tmpl:
      friendly_name_template: Condizione Giornaliera
      value_template: >
        {{ states('sensor.dark_sky_hourly_summary') }}
      entity_picture_template: >-
        {{ '/local/icons/dark_sky/' ~ states.sensor.dark_sky_hourly_summary.attributes.entity_picture | replace("/static/images/darksky/","") | replace(".svg","") ~ '.png'}}
    dark_sky_wind_dir:
      friendly_name: 'Direzione Vento'
      value_template: >-
        {% set wind_dir = states.weather.dark_sky_wind_bearing.state %}
        {% if wind_dir | float<=23 %}Nord [Tramontana]
        {% elif wind_dir | float>338 %}Nord [Tramontana]
        {% elif 23 < (wind_dir|float) <=68 %}NE [Grecale]
        {% elif 68 < (wind_dir|float) <=113 %}Est [Levante]
        {% elif 113 < (wind_dir|float) <=158 %}SE [Scirocco]
        {% elif 158 < (wind_dir|float) <=203 %}Sud [Ostro]
        {% elif 203 < (wind_dir|float) <=248 %}SO [Libeccio]
        {% elif 248 < (wind_dir|float) <=293 %}Ovest [Ponente]
        {% elif 293 < (wind_dir|float) <=338 %}NO [Maestrale]
        {%- endif %}
      icon_template: mdi:compass
    forecast_0:
      friendly_name_template: Giorno
      value_template: Max | Min | Pioggia
      icon_template: mdi:weather-partlycloudy
    forecast_1:
      friendly_name_template: >
        {%- set date = as_timestamp(now()) + (1 * 86400 ) -%}
        {% set giorno = ["Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato"] %}
        {% set mese = ["Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"] %}
        {% set m_ok = date | timestamp_custom("%m") | int %}
        {% set g_ok = date | timestamp_custom("%w") | int %}
        {{giorno[g_ok] + ' ' + date | timestamp_custom("%d") + ' ' + mese[m_ok - 1]}}
      value_template: >
        {{states.sensor.dark_sky_daytime_high_temperature_1d.state|round(0)}}°|{{states.sensor.dark_sky_overnight_low_temperature_1d.state|round(0)}}°|{{states.sensor.dark_sky_precip_probability_1d.state|round(0)}}%
      entity_picture_template: >-
        {{ '/local/icons/dark_sky/' ~ states.sensor.dark_sky_icon_1d.state ~ '.png'}}
      entity_id: sensor.dark_sky_daytime_high_temperature_1d, sensor.dark_sky_overnight_low_temperature_1d, sensor.dark_sky_precip_probability_1d, sensor.date
    forecast_2:
      friendly_name_template: >
        {%- set date = as_timestamp(now()) + (2 * 86400 ) -%}
        {% set giorno = ["Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato"] %}
        {% set mese = ["Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"] %}
        {% set m_ok = date | timestamp_custom("%m") | int %}
        {% set g_ok = date | timestamp_custom("%w") | int %}
        {{giorno[g_ok] + ' ' + date | timestamp_custom("%d") + ' ' + mese[m_ok - 1]}}
      value_template: >
        {{states.sensor.dark_sky_daytime_high_temperature_2d.state|round(0)}}°|{{states.sensor.dark_sky_overnight_low_temperature_2d.state|round(0)}}°|{{states.sensor.dark_sky_precip_probability_2d.state|round(0)}}%
      entity_picture_template: >-
        {{ '/local/icons/dark_sky/' ~ states.sensor.dark_sky_icon_2d.state ~ '.png'}}
      entity_id: sensor.dark_sky_daytime_high_temperature_2d, sensor.dark_sky_overnight_low_temperature_2d, sensor.dark_sky_precip_probability_2d, sensor.date
    forecast_3:
      friendly_name_template: >
        {%- set date = as_timestamp(now()) + (3 * 86400 ) -%}
        {% set giorno = ["Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato"] %}
        {% set mese = ["Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"] %}
        {% set m_ok = date | timestamp_custom("%m") | int %}
        {% set g_ok = date | timestamp_custom("%w") | int %}
        {{giorno[g_ok] + ' ' + date | timestamp_custom("%d") + ' ' + mese[m_ok - 1]}}
      value_template: >
        {{states.sensor.dark_sky_daytime_high_temperature_3d.state|round(0)}}°|{{states.sensor.dark_sky_overnight_low_temperature_3d.state|round(0)}}°|{{states.sensor.dark_sky_precip_probability_3d.state|round(0)}}%
      entity_picture_template: >-
        {{ '/local/icons/dark_sky/' ~ states.sensor.dark_sky_icon_3d.state ~ '.png'}}
      entity_id: sensor.dark_sky_daytime_high_temperature_3d, sensor.dark_sky_overnight_low_temperature_3d, sensor.dark_sky_precip_probability_3d, sensor.date
    forecast_4:
      friendly_name_template: >
        {%- set date = as_timestamp(now()) + (4 * 86400 ) -%}
        {% set giorno = ["Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato"] %}
        {% set mese = ["Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"] %}
        {% set m_ok = date | timestamp_custom("%m") | int %}
        {% set g_ok = date | timestamp_custom("%w") | int %}
        {{giorno[g_ok] + ' ' + date | timestamp_custom("%d") + ' ' + mese[m_ok - 1]}}
      value_template: >
        {{states.sensor.dark_sky_daytime_high_temperature_4d.state|round(0)}}°|{{states.sensor.dark_sky_overnight_low_temperature_4d.state|round(0)}}°|{{states.sensor.dark_sky_precip_probability_4d.state|round(0)}}%
      entity_picture_template: >-
        {{ '/local/icons/dark_sky/' ~ states.sensor.dark_sky_icon_4d.state ~ '.png'}}
      entity_id: sensor.dark_sky_daytime_high_temperature_4d, sensor.dark_sky_overnight_low_temperature_4d, sensor.dark_sky_precip_probability_4d, sensor.date
    forecast_5:
      friendly_name_template: >
        {%- set date = as_timestamp(now()) + (5 * 86400 ) -%}
        {% set giorno = ["Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato"] %}
        {% set mese = ["Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"] %}
        {% set m_ok = date | timestamp_custom("%m") | int %}
        {% set g_ok = date | timestamp_custom("%w") | int %}
        {{giorno[g_ok] + ' ' + date | timestamp_custom("%d") + ' ' + mese[m_ok - 1]}}
      value_template: >
        {{states.sensor.dark_sky_daytime_high_temperature_5d.state|round(0)}}°|{{states.sensor.dark_sky_overnight_low_temperature_5d.state|round(0)}}°|{{states.sensor.dark_sky_precip_probability_5d.state|round(0)}}%
      entity_picture_template: >-
        {{ '/local/icons/dark_sky/' ~ states.sensor.dark_sky_icon_5d.state ~ '.png'}}
      entity_id: sensor.dark_sky_daytime_high_temperature_5d, sensor.dark_sky_overnight_low_temperature_5d, sensor.dark_sky_precip_probability_5d, sensor.date
    forecast_6:
      friendly_name_template: >
        {%- set date = as_timestamp(now()) + (6 * 86400 ) -%}
        {% set giorno = ["Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato"] %}
        {% set mese = ["Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"] %}
        {% set m_ok = date | timestamp_custom("%m") | int %}
        {% set g_ok = date | timestamp_custom("%w") | int %}
        {{giorno[g_ok] + ' ' + date | timestamp_custom("%d") + ' ' + mese[m_ok - 1]}}
      value_template: >
        {{states.sensor.dark_sky_daytime_high_temperature_6d.state|round(0)}}°|{{states.sensor.dark_sky_overnight_low_temperature_6d.state|round(0)}}°|{{states.sensor.dark_sky_precip_probability_6d.state|round(0)}}%
      entity_picture_template: >-
        {{ '/local/icons/dark_sky/' ~ states.sensor.dark_sky_icon_6d.state ~ '.png'}}
      entity_id: sensor.dark_sky_daytime_high_temperature_6d, sensor.dark_sky_overnight_low_temperature_6d, sensor.dark_sky_precip_probability_6d, sensor.date
    forecast_7:
      friendly_name_template: >
        {%- set date = as_timestamp(now()) + (7 * 86400 ) -%}
        {% set giorno = ["Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato"] %}
        {% set mese = ["Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"] %}
        {% set m_ok = date | timestamp_custom("%m") | int %}
        {% set g_ok = date | timestamp_custom("%w") | int %}
        {{giorno[g_ok] + ' ' + date | timestamp_custom("%d") + ' ' + mese[m_ok - 1]}}
      value_template: >
        {{states.sensor.dark_sky_daytime_high_temperature_7d.state|round(0)}}°|{{states.sensor.dark_sky_overnight_low_temperature_7d.state|round(0)}}°|{{states.sensor.dark_sky_precip_probability_7d.state|round(0)}}%
      entity_picture_template: >-
        {{ '/local/icons/dark_sky/' ~ states.sensor.dark_sky_icon_7d.state ~ '.png'}}
      entity_id: sensor.dark_sky_daytime_high_temperature_7d, sensor.dark_sky_overnight_low_temperature_7d, sensor.dark_sky_precip_probability_7d, sensor.date
 
########################################################################
### Definizione Orario Alba e Tramonto
########################################################################
- platform: template
  sensors:
    sunset_time:
      value_template: '{% set timestamp = as_timestamp(states.sun.sun.attributes.next_setting) | timestamp_custom("%H:%M") %} {{ timestamp.lstrip("0") }}'
      friendly_name: "Tramonto"
 
- platform: template
  sensors:
    sunrise_time:
      value_template: '{% set timestamp = as_timestamp(states.sun.sun.attributes.next_rising) | timestamp_custom("%H:%M") %} {{ timestamp.lstrip("0") }}'
      friendly_name: "Alba"

- platform: time_date
  display_options:
    - time
    - date
    - date_time
    - time_date
    - time_utc
    - beat

- platform: systemmonitor
  resources:
    - type: disk_use_percent
      arg: /home
    - type: disk_free
      arg: /home
    - type: memory_free
    - type: memory_use
    - type: memory_use_percent
    - type: processor_use
    - type: last_boot
    #- type: since_last_boot
    #- type: network_in
    #  arg: eth0
    #- type: network_out
    #  arg: eth0

- platform: template
  sensors:
    uptime:
      friendly_name: Up time
      value_template: "{{ states.sensor.last_boot.state.split('.')[0] }}"
    since_last_boot_templated:
      friendly_name: Last boot
      value_template: >-
        {%- set slb = states.sensor.last_boot.state.split(' ') -%}
        {%- set count = slb | length -%}
        {%- set hms = slb[count - 1] -%}
        {%- set hms_trimmed = hms.split('.')[0] -%}
        {%- set hms_split = hms_trimmed.split(':') -%}
        {%- set hours = hms_split[0] | int -%}
        {%- set minutes = hms_split[1] | int -%}
        {%- set seconds = hms_split[2] | int -%}
        {%- if count == 3 -%}
          {{ slb[0] ~ ' ' ~ slb[1] ~ ' ' }}
        {%- endif -%}
        {%- if hours > 0 -%}
          {%- if hours == 1 -%}
            1 hour
          {%- else -%}
            {{ hours }} hours
          {%- endif -%}
        {%- endif -%}
        {%- if minutes > 0 -%}
          {%- if hours > 0 -%}
            {{ ', ' }}
          {%- endif -%}
          {%- if minutes == 1 -%}
            1 minute
          {%- else -%}
            {{ minutes }} minutes
          {%- endif -%}
        {%- endif -%}
        {%- if seconds > 0 -%}
          {%- if hours > 0 or minutes > 0 -%}
            {{ ', ' }}
          {%- endif -%}
          {%- if seconds == 1 -%}
            1 second
          {%- else -%}
            {{ seconds }} seconds
          {%- endif -%}
        {%- endif -%}

- platform: command_line
  name: CPU Temp
  command: "cat /sys/class/thermal/thermal_zone0/temp"
  unit_of_measurement: "°C"
  value_template: '{{ value | multiply(0.001) | round(1) }}'

- platform: command_line
  command: "cat /sys/class/thermal/thermal_zone0/temp"
  unit_of_measurement: "°C"
  value_template: '{{ value | multiply(0.001) | round(2) }}'

- platform: sql
  db_url: !secret dburl
  queries:
    - name: MariaDB size
      query: 'SELECT table_schema "homeassistant", Round(Sum(data_length + index_length) / 1024 / 1024, 1) "value" FROM information_schema.tables WHERE table_schema="homeassistant" GROUP BY table_schema;'
      column: 'value'
      unit_of_measurement: MB

- platform: authenticated


================================================
FILE: switch.yaml
================================================
- platform: broadlink
  host: 10.10.10.220
  mac: 'AA:AA:AA:AA:AA:AA'
  timeout: 15
  switches:
    air:
      friendly_name: "Air Conditioner - Heat 30"
      command_on: 'JgBMAnE3DykPKQ8NDw0NDw4qDg4ODQ4qDykPDQ8pDw0NDw4qDikPDQ4qDykODg4ODykODg4ODikPDQ4ODw0PDQ8NDQ8PDQ4ODw0ODg4ODg0PDQ8NDw0PDQ8NDg4PDQ4ODioODg4ODg0PDQ8NDykPDQ8NDw0NDw4ODykOKQ8pDw0ODg4ODg4NDw0PDg4ODg4qDikPDQ4ODw0PDQ4qDw0ODg0PDikPDQ8NDw0PDQ8NDw0ODg4ODQ8ODg4ODg4ODQ8NDw0PDQ8NDw0PDQ8NDQ8ODg4ODg4ODQ8NDg4PDQ4ODg4ODg4ODg4ODg0PDg4ODg4NDw0PDQ8NDg4PDQ8NDg4ODg4ODg4ODg0PDg0PDQ8NDw0PDQ8NDw0OKg4qDikPKQ8pDykODg4qDgABq3A4DykOKg4ODg0PDQ8pDw0PDQ8pDykNDw0rDg0PDQ4qDykPDQ4qDioODg4NDykPDQ8NDykPDQ4ODg4ODg4ODg0PDQ8NDg4PDQ8NDw0PDQ4ODg4ODg4ODQ8NDg8NDykPDQ8NDw0ODg8NDSsODg0ODw0PDQ8NDykNKw8pDg4ODg4NDw0PDQ8NDw0PDQ4qDioODg0PDg4ODQ8pDw0PDQ8NDykPDQ4ODg4ODg4ODg0PDQ8NDw0PDQ8NDg4ODg4ODg4ODg4ODg0PDQ8NDw0PDQ4ODg4ODg4ODg4ODg4ODg0PDQ8NDw0PDQ8NDw0PDQ4ODg4ODg4ODg0ODg8NDw0PDQ8NDw0PDQ8NDg4ODg4ODg4ODQ8NDw0PKQ8pDykOKg4pDykPDQ8pDwANBQ4qDikPKQ8pDykODg=='
      command_off: 'JgBMAnE4DikPKQ8NDw0ODg4qDw0ODg4qDikPDQ8pDw0PDQ8pDioODg4pDykPDQ8NDykPDQ4ODioODg4ODg0PDQ8NDw0PDQ8NDw0PDQ4ODg4ODg4ODg0PDQ8NDw0PDQ8NDw0ODg4ODg4ODg4ODikPDQ8NDw0PDQ4ODykOKg4pDw0PDQ8NDw0PDQ8NDg4PDQ4qDikPDQ8NDw0PDQ8qDg0ODg4ODikPDQ8NDw0PDQ8NDw0PDQ4ODg4ODg4ODg0PDQ8NDw0PDQ8NDw0PDQ4ODg4ODg4ODg4ODQ8NDw0PDQ8NDw0ODg4ODg4ODg4ODg4ODg4NDw0PDQ8NDw0PDQ8NDw0NDw4ODg4NDg8NDw0PDQ8NDw0ODg8NDw0OKg4pDykPKQ8pDw0ODg0rDgABqnE4DioOKQ8NDw0PDQ8pDw0PDQ8pDioODg4pDw0PDQ8pDykPDQ4qDikPDQ8NDioPDQ8NDykODg4ODg4ODg4NDw0ODg8NDw0PDQ8NDw0PDQ4ODg4ODg4NDw0PDQ8NDw0PDQ8NDw0ODg4ODioODQ8NDw0PDQ8NDykPKQ4qDg4ODQ8NDw0PDQ8NDw0PDQ4rDSoODg4ODg0PDQ8qDg0PDQ8NDioPDQ4ODg4ODQ8NDw0PDQ8NDw0ODg4ODg4ODg4ODg4ODQ8NDw0PDQ8NDw0ODg4ODg4ODg0PDg4ODg4NDw0PDQ8NDw0PDQ8NDg4PDQ4ODg4ODQ8NDw0PDQ8NDw0PDQ8NDg4ODg4ODg4ODg4NDw0PDQ8NDw0PKg4pDioOKQ8pDw0PDQ8pDwANBQ4pDykPKQ8pDw0ODg=='

- platform: broadlink
  host: 10.10.10.202
  mac: 'AA:AA:AA:AA:AA:AA'
  timeout: 15
  switches:
    air2:
      friendly_name: "Air Conditioner - Cold 18"
      command_on: 'JgBMAnE4DikPKQ8NDw0PDQ8pDw0PDQ4qDioODQ8pDw0PDQ8qDikODg4qDikPDQ8NDykPDQ8NDykODg4ODg4ODg4ODg0PDQ8NDw0PDQ8NDw0ODg8NDg4ODg4ODg4ODg4NDykPDQ8NDw0PDQ8NDykOKg4ODg0PDQ8NDykPDQ8NDw0ODg4ODg4ODg4pDykPDQ8pDykPDQ4ODg4ODg4pDw0PDQ8NDykPDQ8NDw0ODg4ODg4ODg4ODg4ODQ8NDw0PDQ8NDw0PDQ8NDw0ODg4ODg4ODg4NDw0PDQ8NDw0PDQ8NDw0ODg4ODg4ODg4ODg0PDQ8NDw0PDQ8NDw0ODg8NDg4ODg4ODg4ODQ8NDw0PDQ8NDw0PDQ8NDw0OKg4ODg4OKQ8NDw0PKQ8pDwABqnE3DykPKQ8NDg4ODg4qDg4ODg4pDykPDQ8pDw0PDQ8pDikPDQ8pDykPDQ8NDioODg4ODioODg4NDw0PDQ8NDw0PDQ8NDg4ODg4ODg4ODg4ODg0PDQ8NDw0PDQ8NDykODg4ODg4ODg4ODikPKQ8NDw0PDQ8NDioODg4ODg4ODQ8NDw0PDQ8pDykPDQ4qDikPDQ8NDw0PDQ8pDw0PDQ8NDykODg4ODg4ODQ8NDw0PDQ8NDw0PDQ8NDw0ODg4ODg4ODg4NDw0PDQ8NDw0PDQ8NDw0PDQ4ODg4ODg4ODg4ODQ8NDw0PDQ8NDw0PDQ8NDw0ODg4ODg4ODg4NDw0PDQ8NDw0PDQ8NDg4PDQ4ODg4ODg4ODg4OKQ8NDw0PKQ8NDw0OKg4qDgANBQ4ODg4OKQ8NDw0PKQ=='
      command_off: 'JgBMAnE4DioOKQ8NDg4PDQ8pDw0PDQ4qDioODg4pDw0PDQ8pDykPDQ4qDikPDQ8NDykPDQ8NDykPDQ4ODg4ODg4NDw0PDQ8NDw0PDQ4ODg4ODg4ODg4ODg4ODg0PDQ8NDg4ODg4ODw0PDQ4ODioOKQ8NDw0PDQ8NDykPDQ4ODw0ODg4ODg4ODQ8pDykPDQ8pDioODg4ODg4ODQ8pDw0PDQ8NDykPDQ4ODg4ODg4ODg0PDQ8NDw0PDQ8NDw0PDQ4ODg4ODg4ODg4ODQ8NDw0PDQ8NDw0ODg8NDg4ODg4ODg4ODQ8NDw0PDQ8NDw0PDQ8NDw0ODg4ODg4ODg4NDg4PDQ8NDw0PDQ0PDg4PDQ8NDg4ODg4ODg0PKQ8NDw0PKQ8NDykODg4qDgABqnA5DioOKQ8NDw0PDQ8pDw0PDQ4qDikPDQ8pDw0PDQ8pDykODg4qDikPDQ8NDykPDQ8NDykPDQ4ODg4ODg4NDw0PDQ8NDw0PDQ8NDw0PDQ4ODg4ODg4ODg0PDQ8NDw0PDQ8NDg4ODg4ODioOKQ8NDw0PDQ8NDykPDQ8NDg4ODg4ODg4ODg4pDykPDQ8pDioODg0PDg4ODg4pDw0PDQ8NDykPDQ8NDw0ODg4ODg4ODQ8NDw0PDQ8NDw0PDQ4ODg4ODg4ODg4ODg4NDw0PDQ8NDw0PDQ8NDQ8PDQ4ODg4ODg4ODg0PDQ8NDw0PDQ8NDw0ODg4ODg4ODg4ODg4ODQ8NDw0PDQ8NDg4PDQ8NDg4ODg4ODg4OKQ8NDg4PKQ8NDioPDQ4qDgANBQ8NDw0PKQ8NDykODg=='

- platform: broadlink
  host: 10.10.10.220
  mac: 'AA:AA:AA:AA:AA:AA'
  timeout: 15
  switches:
    air3:
      friendly_name: "Air Conditioner - Humidity"
      command_on: 'JgBMAnE3ECgPKQ8NDw0PDQ8pDw0PDQ8oECgPDQ8pDw0PDQ8pDygQDBAoDykPDQ8NDykPDQ8NDygQDBAMDw0PDQ8NDw0PDQ8NDw0PDQ8NDw0PDBAMEAwPDQ8NDw0PDQ8NDykPDQ8NDw0PDBANDikPDQ8NDw0PDQ8NDykPKBAoDw0PDQ8NDw0PDQ8NDwoSDQ8oECgPDQ8NDw0PDQ8NDw0PDQ8NDygQChIMDw4ODQ8NDw0PDQ8NDw0PDQ8NDwoSDBAMDw0PDQ8NDw0PDQ8NDw0PDQ8NDw0PDBAMDw0PDQ8NDw0PDQ8NDw0PDQ8NDw0PDBAMEAwPDQ8NDw0PDQ8NDw0PDQ8NDw0PDBAMEAwPDQ8NDw0PDQ8NDw0PKQ8oEAwQKA8pDykPDQ8pDwABqXI3DykPKBAMEAwQDA8pDw0PDQ8pDykPDQ8oEAwPDQ8pDykPDQ8pDygQDBAMDykPDQ8NDykPDQ8NDw0PDBAMEAwPDQ8NDw0PDQ8NDw0PDQ8NDw0PDQ8MEAwPDQ8NDykPDQ8NDw0PDQ8NDygQDBAMDwoSDQ8NDykPKQ8pDwwQDBAMDw0PDQ8NDw0PDQ8pDygQDBAMEAwPDQ8NDw0PDBANDykPDQ8NDwwQDBANDg0PDQ8NDw0PDQ8NDw0PDQ8NDwwQDBAMDw0PDQ8NDw0PDQ8NDw0PDQ8NDwwQDBAMDw0PDQ8NDw0PDQ8NDw0PDQ8NDw0PDBAMDw0PDQ8NDw0PDQ8NDw0PDQ8NDw0PDBAMDwoSDQ8NDw0PKQ8pDw0PKBAoDykPDQ8pDwANBQ8oEAwQKA8pDykPDQ=='
      command_off: 'JgBMAnE4DioOKQ8NDg4PDQ8pDw0PDQ4qDioODg4pDw0PDQ8pDykPDQ4qDikPDQ8NDykPDQ8NDykPDQ4ODg4ODg4NDw0PDQ8NDw0PDQ4ODg4ODg4ODg4ODg4ODg0PDQ8NDg4ODg4ODw0PDQ4ODioOKQ8NDw0PDQ8NDykPDQ4ODw0ODg4ODg4ODQ8pDykPDQ8pDioODg4ODg4ODQ8pDw0PDQ8NDykPDQ4ODg4ODg4ODg0PDQ8NDw0PDQ8NDw0PDQ4ODg4ODg4ODg4ODQ8NDw0PDQ8NDw0ODg8NDg4ODg4ODg4ODQ8NDw0PDQ8NDw0PDQ8NDw0ODg4ODg4ODg4NDg4PDQ8NDw0PDQ0PDg4PDQ8NDg4ODg4ODg0PKQ8NDw0PKQ8NDykODg4qDgABqnA5DioOKQ8NDw0PDQ8pDw0PDQ4qDikPDQ8pDw0PDQ8pDykODg4qDikPDQ8NDykPDQ8NDykPDQ4ODg4ODg4NDw0PDQ8NDw0PDQ8NDw0PDQ4ODg4ODg4ODg0PDQ8NDw0PDQ8NDg4ODg4ODioOKQ8NDw0PDQ8NDykPDQ8NDg4ODg4ODg4ODg4pDykPDQ8pDioODg0PDg4ODg4pDw0PDQ8NDykPDQ8NDw0ODg4ODg4ODQ8NDw0PDQ8NDw0PDQ4ODg4ODg4ODg4ODg4NDw0PDQ8NDw0PDQ8NDQ8PDQ4ODg4ODg4ODg0PDQ8NDw0PDQ8NDw0ODg4ODg4ODg4ODg4ODQ8NDw0PDQ8NDg4PDQ8NDg4ODg4ODg4OKQ8NDg4PKQ8NDioPDQ4qDgANBQ8NDw0PKQ8NDykODg=='


================================================
FILE: themes/amoled.yaml
================================================
---
#
# Amoled Theme
#
amoled:
  accent-color: "#E45E65"
  dark-primary-color: "var(--accent-color)"
  disabled-text-color: "#7F848E"
  divider-color: "rgba(0, 0, 0, .12)"
  google-green-500: "#39E949"
  google-red-500: "#E45E65"
  label-badge-background-color: "#2E333A"
  label-badge-border-color: "green"
  label-badge-red: "var(--accent-color)"
  label-badge-text-color: "var(--primary-text-color)"
  light-primary-color: "var(--accent-color)"
  paper-button-color: "#5294E2"
  paper-button-ink-color: "#5294E2"
  paper-card-background-color: "#000000"
  paper-card-header-color: "var(--accent-color)"
  paper-dialog-background-color: "#000000"
  paper-grey-200: "#414A59"
  paper-grey-50: "var(--primary-text-color)"
  paper-item-icon-active-color: "#F9C536"
  paper-item-icon-color: "var(--primary-text-color)"
  paper-item-icon_-_color: "green"
  paper-item-selected_-_background-color: "#434954"
  paper-listbox-background-color: "#000000"
  paper-listbox-color: "#FFFFFF)"
  paper-slider-active-color: "var(--accent-color)"
  paper-slider-container-color: "linear-gradient(var(--primary-background-color), var(--secondary-background-color)) no-repeat"
  paper-slider-disabled-active-color: "var(--disabled-text-color)"
  paper-slider-disabled-secondary-color: "var(--disabled-text-color)"
  paper-slider-knob-color: "var(--accent-color)"
  paper-slider-knob-start-color: "var(--accent-color)"
  paper-slider-pin-color: "var(--accent-color)"
  paper-slider-secondary-color: "var(--secondary-background-color)"
  paper-tabs-selection-bar-color: "green"
  paper-toggle-button-checked-bar-color: "var(--accent-color)"
  paper-toggle-button-checked-button-color: "var(--accent-color)"
  paper-toggle-button-checked-ink-color: "var(--accent-color)"
  paper-toggle-button-unchecked-bar-color: "var(--disabled-text-color)"
  paper-toggle-button-unchecked-button-color: "var(--disabled-text-color)"
  paper-toggle-button-unchecked-ink-color: "var(--disabled-text-color)"
  primary-background-color: "#000000"
  primary-color: "#484A4C"
  primary-text-color: "#FFFFFF"
  secondary-background-color: "#383C45"
  secondary-text-color: "#5294E2"
  sidebar-icon-color: "var(--primary-color)"
  sidebar-selected-icon-color: "var(--primary-text-color)"
  sidebar-selected-text-color: "var(--primary-text-color)"
  sidebar-text-color: "var(--primary-color)"
  table-row-alternative-background-color: "#3E424B"
  table-row-background-color: "#353840"
  text-primary-color: "var(--primary-text-color)"


================================================
FILE: themes/another-dark.yaml
================================================
---
#
# Another Dark Theme
#
another_dark:
  disabled-text-color: "rgba(255, 255, 255, 0.5)"
  divider-color: "rgba(255, 255, 255, 0.12)"
  paper-card-background-color: "#424242"
  paper-card-header-color: "#FFFFFF"
  paper-grey-200: "#616161"
  paper-item-icon-color: "#1ABA92"
  paper-listbox-background-color: "#424242"
  paper-listbox-color: "#FFFFFF"
  paper-slider-active-color: "#1ABA92"
  paper-slider-knob-color: "#1ABA92"
  paper-slider-knob-start-color: "#1ABA92"
  paper-slider-pin-color: "#1ABA92"
  paper-slider-secondary-color: "#33F2D8"
  paper-toggle-button-checked-bar-color: "#1ABA92"
  paper-toggle-button-checked-button-color: "#1ABA92"
  paper-toggle-button-checked-ink-color: "#1ABA92"
  primary-background-color: "#303030"
  primary-color: "#1ABA92"
  primary-text-color: "#FFFFFF"
  secondary-background-color: "#303030"
  secondary-text-color: "rgba(255, 255, 255, 0.7)"
  table-row-alternative-background-color: transparant
  table-row-background-color: transparant


================================================
FILE: themes/binary_sensors.yaml
================================================
  #- platform: iss
  
  
  # - platform: mqtt
  #   state_topic: dummy/floorplan/sensor
  #   name: Floorplan
  - platform: workday
    country: IT
    province: RM
    workdays: [mon, tue, wed, thu, fri]

  - platform: meteoalarm
    country: 'IT'
    province: 'Lazio'

  # - platform: template
  #   sensors:
  #     nico_battery_low:
  #       value_template: "{{ state_attr('device_tracker.nico_nico', 'battery') < 36 }}"
  #       friendly_name: 'Nico Tel Battery is low'

  # - platform: template
  #   sensors:
  #     mom_battery_low:
  #       value_template: "{{ state_attr('device_tracker.mamma_mamma', 'battery') < 36 }}"
  #       friendly_name: 'Mom Tel Battery is low'

  # - platform: template
  #   sensors:
  #     nico_car:
  #       value_template: "{{ state_attr('device_tracker.nico_nico', 'velocity') > 30 }}"
  #       friendly_name: 'Nico in Car'

  # - platform: template
  #   sensors:
  #     mom_car:
  #       value_template: "{{ state_attr('device_tracker.mamma_mamma', 'velocity') > 30 }}"
  #       friendly_name: 'Mom in Car'


  - platform: mqtt
    name: "My Computer - Connected"
    state_topic: "iotlink/workgroup/my-computer/lwt"
    value_template: "{{ value }}"
    payload_on: "ON"
    payload_off: "OFF"
    device_class: "connectivity"
    qos: 1

  - platform: mqtt
    name: "My Computer - Charging"
    state_topic: "iotlink/workgroup/my-computer/windows-monitor/stats/power/status"
    value_template: "{{ value }}"
    payload_on: "Online"
    payload_off: "Offline"
    device_class: "plug"
    availability_topic: "iotlink/workgroup/my-computer/lwt"
    payload_available: "ON"
    payload_not_available: "OFF"
    qos: 1

  # - platform: mqtt
  #   name: "My Computer - Battery Status"
  #   state_topic: "iotlink/workgroup/my-computer/windows-monitor/stat
Download .txt
gitextract_3yxyy90d/

├── .gitignore
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── PULL_REQUEST_TEMPLATE.md
├── README.md
├── alarm.yaml
├── announcements.yaml
├── automations.yaml
├── camera.yaml
├── configuration.yaml
├── cover.yaml
├── customize.yaml
├── device_tracker.yaml
├── google.yaml
├── groups.yaml
├── input_boolean/
│   └── trigger_booleans.yaml
├── input_select/
│   ├── ac_mode.yaml
│   ├── living_bright.yaml
│   ├── living_scene.yaml
│   ├── log_level.yaml
│   ├── lounge_scene.yaml
│   ├── nico_room_scene.yaml
│   ├── pc_power_options.yaml
│   └── who_cook.yaml
├── input_slider/
│   └── living_bright.yaml
├── ip_bans.yaml
├── light.yaml
├── media_player.yaml
├── mqtt.yaml
├── notify.yaml
├── panel_custom.yaml
├── scene/
│   ├── TV_Time.yaml
│   ├── TV_Time_off.yaml
│   ├── living.yaml
│   ├── living_lights_off.yaml
│   ├── living_lights_on.yaml
│   ├── monthly_colors.yaml
│   ├── movies.yaml
│   ├── my_room.yaml
│   ├── romantic.yaml
│   └── romatic_my.yaml
├── scripts/
│   ├── low_battery.yaml
│   ├── monthly_color_scene.yaml
│   ├── refresh_devices.yaml
│   ├── restart_ha.yaml
│   ├── scene_notify.yaml
│   ├── sunrise.yaml
│   ├── sunset.yaml
│   └── voice_notify.yaml
├── scripts.yaml
├── sensor.yaml
├── switch.yaml
├── themes/
│   ├── amoled.yaml
│   ├── another-dark.yaml
│   ├── binary_sensors.yaml
│   ├── darkblue.yaml
│   ├── darkcyan.yaml
│   ├── darkorange.yaml
│   ├── darkred.yaml
│   ├── grey-night.yaml
│   ├── grey_night.yaml
│   ├── material_dark_green.yaml
│   ├── material_dark_pink.yaml
│   ├── midnight.yaml
│   └── slate.yaml
└── ui-lovelace.yaml
Condensed preview — 67 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (305K chars).
[
  {
    "path": ".gitignore",
    "chars": 5,
    "preview": ".uuid"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "chars": 5467,
    "preview": "# Code of Conduct\n\n## 1. Purpose\n\nA primary goal of Homeassistant Example Config is to be inclusive to the largest numbe"
  },
  {
    "path": "CONTRIBUTING.md",
    "chars": 2009,
    "preview": "---\nlayout: page\ntitle: \"Contributor License Agreement\"\ndescription: \"The Code of Conduct for Home Assistant projects.\"\n"
  },
  {
    "path": "LICENSE",
    "chars": 11357,
    "preview": "                                 Apache License\n                           Version 2.0, January 2004\n                   "
  },
  {
    "path": "PULL_REQUEST_TEMPLATE.md",
    "chars": 1728,
    "preview": "Submit your work\n\nSubmit your improvements, fixes, and new features to Homeassistant-Example-Config one at a time, using"
  },
  {
    "path": "README.md",
    "chars": 1600,
    "preview": "# Homeassistant Template Example By Nicolò Steffè\n\nHome assistant Configuration (YAMLs)\n\nThis is my Home Assistant Confi"
  },
  {
    "path": "alarm.yaml",
    "chars": 63,
    "preview": "platform: manual\nname: House\npending_time: 30\ntrigger_time: 600"
  },
  {
    "path": "announcements.yaml",
    "chars": 1097,
    "preview": "  #alias: 'People Greeting'\n  #trigger:\n    #- platform: state\n      #entity_id:\n        #- device_tracker.my_my\n       "
  },
  {
    "path": "automations.yaml",
    "chars": 81055,
    "preview": "# - id: letsencrypt-renewal-30d-before-expiry\n#   alias: Let's Encrypt Renewal at 15 Days before expiration\n#   initial_"
  },
  {
    "path": "camera.yaml",
    "chars": 1819,
    "preview": "- platform: onvif\n  host: 1.1.1.1\n  username: !secret e1user\n  password: !secret e1pwd\n  port: 5000\n\n- platform: generic"
  },
  {
    "path": "configuration.yaml",
    "chars": 20497,
    "preview": "####################################################\n#                                                  #\n#             "
  },
  {
    "path": "cover.yaml",
    "chars": 604,
    "preview": "- platform: mqtt\n  name: \"Serranda Salone\"    \n  command_topic: \"shellies/shellyswitch25-abcd1234/roller/0/command\" \n  p"
  },
  {
    "path": "customize.yaml",
    "chars": 2827,
    "preview": "####################################################\n#                                                  #\n#             "
  },
  {
    "path": "device_tracker.yaml",
    "chars": 434,
    "preview": "- platform: fritz\n  host: 10.10.10.1\n  username: !secret fritz_user\n  password: !secret fritz_pwd\n\n- platform: fritz\n  h"
  },
  {
    "path": "google.yaml",
    "chars": 71,
    "preview": "client_id: !secret google_clientid\nclient_secret: !secret google_secret"
  },
  {
    "path": "groups.yaml",
    "chars": 1239,
    "preview": "\n\n############################################################\n#                                                        "
  },
  {
    "path": "input_boolean/trigger_booleans.yaml",
    "chars": 281,
    "preview": "#triggers\n#good_night:\n  #name: Good Night\n  #initial: off\n\n#good_morning:\n  #name: Good Morning\n  #initial: off\n\n#meal_"
  },
  {
    "path": "input_select/ac_mode.yaml",
    "chars": 203,
    "preview": "ac_mode:\n  name: AC Mode Morning\n  options:\n    - Power Off\n    - Hot\n    - Hot Morning\n    - Cold\n    - Cold Morning\n  "
  },
  {
    "path": "input_select/living_bright.yaml",
    "chars": 121,
    "preview": "living_bright:\n  name: Living Brightness\n  options:\n    - Low\n    - Medium\n    - Max\n  initial: Max\n  icon: mdi:lightbul"
  },
  {
    "path": "input_select/living_scene.yaml",
    "chars": 173,
    "preview": "living_scene:\n  name: Living Scenes\n  options:\n    - White\n    - Romantic (Red)\n    - Movie (Blue)\n    - Gold\n    - Purp"
  },
  {
    "path": "input_select/log_level.yaml",
    "chars": 155,
    "preview": "log_level:\n  name: Log Level\n  options:\n    - critical\n    - fatal\n    - error\n    - warning\n    - warn\n    - info\n    -"
  },
  {
    "path": "input_select/lounge_scene.yaml",
    "chars": 173,
    "preview": "Living_scene:\n  name: Living Scenes\n  options:\n    - White\n    - Romantic (Red)\n    - Movie (Blue)\n    - Gold\n    - Purp"
  },
  {
    "path": "input_select/nico_room_scene.yaml",
    "chars": 175,
    "preview": "my_room_scene:\n  name: my Room Scenes\n  options:\n    - White\n    - Romantic (Red)\n    - Movie (Blue)\n    - Gold\n    - Pu"
  },
  {
    "path": "input_select/pc_power_options.yaml",
    "chars": 156,
    "preview": "pcoptions:\n  name: PC Power Options\n  options:\n    - Restart\n    - Shutdown\n    - None\n    - Sleep\n    - Hibernate\n  ini"
  },
  {
    "path": "input_select/who_cook.yaml",
    "chars": 116,
    "preview": "who_cooks:\n  name: Who cooks today\n  options:\n    - my\n    - Rossella\n    - gf\n  initial: Rossella\n  icon: mdi:panda"
  },
  {
    "path": "input_slider/living_bright.yaml",
    "chars": 85,
    "preview": "living_bright:\n  name: Lights Brightness\n  initial: 254\n  min: 0\n  max: 254\n  step: 1"
  },
  {
    "path": "ip_bans.yaml",
    "chars": 1,
    "preview": "\n"
  },
  {
    "path": "light.yaml",
    "chars": 561,
    "preview": "  - platform: yeelight\n    devices:\n      10.10.10.239:\n        name: Living - Sofa - RGB\n        #transition: 1000\n    "
  },
  {
    "path": "media_player.yaml",
    "chars": 119,
    "preview": "#- platform: cast\n  #host: 10.10.10.215\n- platform: braviatv\n  host: 10.10.10.215\n- platform: kodi\n  host: 10.10.10.215"
  },
  {
    "path": "mqtt.yaml",
    "chars": 185,
    "preview": "\n### MOSQUITTO ON HASSIO ###\nbroker: !secret mqtt_broker\nusername: !secret mqtt_hassio_user\npassword: !secret mqtt_hassi"
  },
  {
    "path": "notify.yaml",
    "chars": 158,
    "preview": "- name: hassnico_bot\n  platform: telegram\n  api_key: !secret telegram_apikey\n  chat_id: !secret telegram_clientid\n\n- pla"
  },
  {
    "path": "panel_custom.yaml",
    "chars": 132,
    "preview": "  - name: react\n    sidebar_title: Panel Switch\n    sidebar_icon: mdi:settings\n    url_path: todomvc\n    config:\n      t"
  },
  {
    "path": "scene/TV_Time.yaml",
    "chars": 313,
    "preview": "- name: TV Time\n  entities:\n       light.Living__sofa__rgb:\n           state: on\n           color_name: 'darkblue'\n     "
  },
  {
    "path": "scene/TV_Time_off.yaml",
    "chars": 306,
    "preview": "- name: TV Time\n  entities:\n       light.Living__sofa__rgb:\n           state: on\n           color_name: 'white'\n        "
  },
  {
    "path": "scene/living.yaml",
    "chars": 1707,
    "preview": "- name: White - Living\n  entities:\n    light.Living__sofa__rgb:\n      state: on\n      color_name: 'white'\n      brightne"
  },
  {
    "path": "scene/living_lights_off.yaml",
    "chars": 182,
    "preview": "- name: Lights OFF - Living\n  entities:\n    light.Living__sofa__rgb:\n      state: off\n    light.Living__window__white:\n "
  },
  {
    "path": "scene/living_lights_on.yaml",
    "chars": 310,
    "preview": "- name: Lights ON - Living\n  entities:\n    light.Living__sofa__rgb:\n      state: on\n      rgb_color: [255, 255, 255]\n   "
  },
  {
    "path": "scene/monthly_colors.yaml",
    "chars": 1520,
    "preview": "- name: month_standard_colors\n  entities:\n       light.room__my__rgb:\n           state: 'on'\n           color_name: 'Gol"
  },
  {
    "path": "scene/movies.yaml",
    "chars": 270,
    "preview": "- name: Movies - Living\n  entities:\n    light.Living__sofa__rgb:\n      state: on\n      color_name: 'blue'\n      brightne"
  },
  {
    "path": "scene/my_room.yaml",
    "chars": 726,
    "preview": "- name: White - my\n  entities:\n    light.room__my__rgb:\n      state: on\n      color_name: 'white'\n      brightness: 255\n"
  },
  {
    "path": "scene/romantic.yaml",
    "chars": 320,
    "preview": "- name: Romantic - Living\n  entities:\n    light.Living__sofa__rgb:\n      state: on\n      color_name: red\n      brightnes"
  },
  {
    "path": "scene/romatic_my.yaml",
    "chars": 118,
    "preview": "- name: Romantic - my\n  entities:\n    light.room__my__rgb:\n      state: on\n      color_name: red\n      brightness: 200"
  },
  {
    "path": "scripts/low_battery.yaml",
    "chars": 477,
    "preview": "sequence:\n- event: LOGBOOK_ENTRY\n  event_data:\n    name: EVENT\n    message: \"Low battery Event\"\n- service: notify.homemy"
  },
  {
    "path": "scripts/monthly_color_scene.yaml",
    "chars": 3364,
    "preview": "######################################################################################################\n###Script to turn"
  },
  {
    "path": "scripts/refresh_devices.yaml",
    "chars": 280,
    "preview": "sequence:\n- service: mqtt.publish\n  data:\n    topic: \"owntracks/my/my/cmd\"\n    payload_template: '{\"_type\":\"cmd\",\"action"
  },
  {
    "path": "scripts/restart_ha.yaml",
    "chars": 261,
    "preview": "sequence:\n- event: LOGBOOK_ENTRY\n  event_data:\n    name: EVENT\n    message: \"Restarting Home Assistant\"\n- service: notif"
  },
  {
    "path": "scripts/scene_notify.yaml",
    "chars": 304,
    "preview": "  sequence:\n    - condition: and\n      conditions:\n        - condition: or\n          conditions:\n            - condition"
  },
  {
    "path": "scripts/sunrise.yaml",
    "chars": 211,
    "preview": "sequence:\n- event: LOGBOOK_ENTRY\n  event_data:\n    name: EVENT\n    message: \"SUNRISE\"\n- service: notify.homemyassistant_"
  },
  {
    "path": "scripts/sunset.yaml",
    "chars": 216,
    "preview": "sequence:\n- event: LOGBOOK_ENTRY\n  event_data:\n    name: EVENT\n    message: \"SUNSET\"\n- service: notify.homemyassistant_b"
  },
  {
    "path": "scripts/voice_notify.yaml",
    "chars": 1230,
    "preview": "  sequence:\n    - condition: and\n      conditions:\n        - condition: or\n          conditions:\n            - condition"
  },
  {
    "path": "scripts.yaml",
    "chars": 21527,
    "preview": "####ALARM ####\n\n####TEST SCRIPTS####\n\n####GLOBAL SCRIPTS####\n\n####TRIGGERED LIGHTS\n\n####NOTIFICATIONS AND ALERTS####\n###"
  },
  {
    "path": "sensor.yaml",
    "chars": 13854,
    "preview": "- platform: dnsip\n\n- platform: season\n  type: astronomical\n\n- platform: uptime\n\n- platform: version\n\n- platform: mqtt\n  "
  },
  {
    "path": "switch.yaml",
    "chars": 5444,
    "preview": "- platform: broadlink\n  host: 10.10.10.220\n  mac: 'AA:AA:AA:AA:AA:AA'\n  timeout: 15\n  switches:\n    air:\n      friendly_"
  },
  {
    "path": "themes/amoled.yaml",
    "chars": 2492,
    "preview": "---\n#\n# Amoled Theme\n#\namoled:\n  accent-color: \"#E45E65\"\n  dark-primary-color: \"var(--accent-color)\"\n  disabled-text-col"
  },
  {
    "path": "themes/another-dark.yaml",
    "chars": 993,
    "preview": "---\n#\n# Another Dark Theme\n#\nanother_dark:\n  disabled-text-color: \"rgba(255, 255, 255, 0.5)\"\n  divider-color: \"rgba(255,"
  },
  {
    "path": "themes/binary_sensors.yaml",
    "chars": 2088,
    "preview": "  #- platform: iss\n  \n  \n  # - platform: mqtt\n  #   state_topic: dummy/floorplan/sensor\n  #   name: Floorplan\n  - platfo"
  },
  {
    "path": "themes/darkblue.yaml",
    "chars": 2142,
    "preview": "\n    darkblue:\n      primary-color: \"#396FB6\"\n      light-primary-color: \"#77a0d4\"\n      dark-primary-color: \"#3539ce\"\n "
  },
  {
    "path": "themes/darkcyan.yaml",
    "chars": 1522,
    "preview": "    darkcyan:\n# Main colors that can be changed\n      primary-color: \"#00bcd4\"\n      disabled-text-color: \"#545454\"\n    "
  },
  {
    "path": "themes/darkorange.yaml",
    "chars": 2143,
    "preview": "\n    darkorange:\n      primary-color: \"#ff9800\"\n      light-primary-color: \"#ffc947\"\n      dark-primary-color: \"#c66900\""
  },
  {
    "path": "themes/darkred.yaml",
    "chars": 1674,
    "preview": "    darkred:\n# Main colors that can be changed\n      dark-primary-color: \"#c66900\"\n      disabled-text-color: \"#545454\"\n"
  },
  {
    "path": "themes/grey-night.yaml",
    "chars": 4146,
    "preview": "---\n#\n# Grey Night Theme\n#\ngrey_night:\n  accent-color: \"hsl(var(--huesat) 30%)\"\n  base-hue: \"220\"\n  base-sat: \"5%\"\n  dar"
  },
  {
    "path": "themes/grey_night.yaml",
    "chars": 4146,
    "preview": "---\n#\n# Grey Night Theme\n#\ngrey_night:\n  accent-color: \"hsl(var(--huesat) 30%)\"\n  base-hue: \"220\"\n  base-sat: \"5%\"\n  dar"
  },
  {
    "path": "themes/material_dark_green.yaml",
    "chars": 1867,
    "preview": "---\n#\n# Material Dark Green Theme\n#\nmaterial_dark_green:\n  dark-primary-color: \"var(--red)\"\n  dark_green: \"#017775\"\n  da"
  },
  {
    "path": "themes/material_dark_pink.yaml",
    "chars": 1987,
    "preview": "---\n#\n# Material Dark Pink Theme\n#\nmaterial_dark_pink:\n  accent: \"#FF4081\"\n  accent-color: \"var(--accent)\"\n  card-backgr"
  },
  {
    "path": "themes/midnight.yaml",
    "chars": 5010,
    "preview": "    midnight:\n# Main colors\n      primary-color: '#5294E2'                                                        # Head"
  },
  {
    "path": "themes/slate.yaml",
    "chars": 3518,
    "preview": "slate:\n  # Main colors\n  primary-color: '#2980b9'\n  accent-color: '#b58e31'\n  dark-primary-color: '#2980b9'\n  light-prim"
  },
  {
    "path": "ui-lovelace.yaml",
    "chars": 68802,
    "preview": "title: Casetta - Nico e Mascia\n# Include external resources\nresources:\n\n   - url: /community_plugin/monster-card/monster"
  }
]

About this extraction

This page contains the full source code of the CiquattroFPV/Homeassistant-Example-Config GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 67 files (283.3 KB), approximately 77.0k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!