Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 101645

Greeting last person comming home

$
0
0

@rak wrote:

Hi guys,

I need to share this with you. The task was to identify the last person comming home and greet him/her.

Kudos for the set of different greetings go to CCOSTAN

How to find the last person comming home? Somehow this must be possible. And yes. Its not so difficult at the end.

Here the full code, I hope you like it.

- alias: "Eingang - Identify comming home"
  trigger:
    - platform: state
      entity_id: binary_sensor.hausture
      from: 'off'
      to: 'on'
  condition:
    - condition: state
      entity_id: binary_sensor.eingang_motion
      state: 'off'
      for:
        minutes: 5
    - condition: state
      entity_id: binary_sensor.eingang_someone_known
      state: 'off'
      for:
        minutes: 5
    - condition: state
      entity_id: binary_sensor.eingang_someone_unknown
      state: 'off'
      for:
        minutes: 5
  action:
    - wait_template: "{{ is_state('binary_sensor.hausture', 'off') }}"
      timeout: '00:04:00'
    - delay: '00:02:00'
    - service: notify.alexa_media
      data_template:
        target:
          - media_player.echo_wohnen
        data:
          type: announce
        message: >-
          {% set person = [
            states.person.person1, 
            states.person.person2, 
            states.person.person3, 
            states.person.person4] | 
              sort(reverse=true, attribute='last_changed') |
              selectattr('state','eq','home') | 
              map(attribute='name') | 
              list | first %}
          {% set greeting = [
          "Willkommen zu Hause " ~ person,
          "Ratet mal wer heimgekommen ist ? " ~ person ~ "!",
          person ~ " ist nun im Haus.",
          "Willkommen zu Hause " ~ person ~ ".  Wir haben dich vermisst.",
          "Unser Zuhause ist jetzt komplett. Ruhe dich aus " ~ person ~ "!",
          "Hallo " ~ person ~ " Willkommen zu Hause!",
          "Eine Raum Zeit Verschiebung ich wahrnehme. Heimgekommen "  ~ person ~ " ist!",
          "Und das Haus wird wieder zu einem Zuhause. Willkommen zurück " ~ person ~ ".",
          person ~ " ist nun hier. Hash tag Willkommen zu Hause.",
          "Eine kurze Ankündigung. " ~ person ~ " ist angekommen!",
          "Entschuldigt die Störung, aber " ~ person ~ " is zurück!",
          "Das System hat die Ankunft eines weiteren Humanoiden erkannt. " ~ person ~ " wurde zu Hause identifiziert.",
          "Es sieht so aus als ob " ~ person ~ " nun endlich wieder zu Hause ist! Klasse. "
          ] | random %}
          {{greeting}}

I hopy you like it. Enjoy.

Regards
Ralf

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 101645

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>