finomított univerzális helység alapú bemondás

alias: finomított univerzális helység alapú bemondás
description: >
  Megkeresi a jelenlegi vagy a legutóbb aktív helyiséget, de ha több aktív 
  helyiség/személy van, biztonsági okokból az Előszobába küldi a bemondást.
sequence:
  - action: automation.turn_off
    metadata: {}
    target:
      entity_id: automation.ido_bemondas
    data:
      stop_actions: true
    enabled: false
  - variables:
      helyisegek:
        - nev: Hálószoba
          szenzor: binary_sensor.halo_hangszoro_haloszoba_jelenlet
          hangszoro: media_player.halo_hangszoro_creative
          halkito_kapcsolo: ''
        - nev: Iroda
          szenzor: binary_sensor.iroda_hifi_iroda_jelenlet
          hangszoro: media_player.iroda_hifi_iroda_hifi
          halkito_kapcsolo: switch.iroda_hifi_radio_halkitas_vezerles
        - nev: Előszoba
          szenzor: binary_sensor.illatosito_vezerlo_jelenlet_radar_out_lab
          hangszoro: media_player.eloszoba_hifi_eloszoba_hifi_2
          halkito_kapcsolo: ''
        - nev: Konyha
          szenzor: binary_sensor.konyha_radar_konyha_jelenlet
          hangszoro: media_player.music_player_daemon
          halkito_kapcsolo: ''
        - nev: Fürdőszoba
          szenzor: binary_sensor.mozgaserzekelo_foglaltsag_2
          hangszoro: media_player.eloszoba_hifi_eloszoba_hifi_2
          halkito_kapcsolo: ''
        - nev: WC
          szenzor: binary_sensor.mozgaserzekelo_2_foglaltsag_2
          hangszoro: media_player.eloszoba_hifi_eloszoba_hifi_2
          halkito_kapcsolo: ''
      aktiv_helyisegek: '{{ helyisegek | selectattr(''szenzor'', ''is_state'', ''on'') | list }}'
      aktiv_szam: '{{ aktiv_helyisegek | count }}'
      utolso_adat: >-
        {% set ns = namespace(latest_time=0, latest_name='Előszoba') %} {% for h
        in helyisegek %}
          {% set ent = states[h.szenzor] %}
          {% if ent and ent.last_changed %}
            {% set t = as_timestamp(ent.last_changed, 0) %}
            {% if t > ns.latest_time %}
              {% set ns.latest_time = t %}
              {% set ns.latest_name = h.nev %}
            {% endif %}
          {% endif %}
        {% endfor %} {{ ns.latest_name }}
      cel_hangszoro: |-
        {% if aktiv_szam > 1 %}
          media_player.eloszoba_hifi_eloszoba_hifi_2
        {% elif aktiv_szam > 0 %}
          {{ aktiv_helyisegek[0].hangszoro }}
        {% else %}
          {{ (helyisegek | selectattr('nev', 'eq', utolso_adat | trim) | map(attribute='hangszoro') | list) | first | default('media_player.eloszoba_hifi_eloszoba_hifi_2') }}
        {% endif %}
      cel_kapcsolo: |-
        {% if aktiv_szam > 1 %}
          {{ "" }}
        {% else %}
          {% set aktualis_nev = aktiv_helyisegek[0].nev if aktiv_szam > 0 else (utolso_adat | trim) %}
          {{ (helyisegek | selectattr('nev', 'eq', aktualis_nev) | map(attribute='halkito_kapcsolo') | list) | first | default('') }}
        {% endif %}
      mpd_volt_e_aktiv: >-
        {{ cel_hangszoro == 'media_player.music_player_daemon' and
        states('media_player.music_player_daemon') == 'playing' }}
      mpd_forras: '{{ state_attr(''media_player.music_player_daemon'', ''media_content_id'') }}'
  - choose:
      - conditions:
          - condition: template
            value_template: '{{ cel_kapcsolo != '''' and states(cel_kapcsolo) is defined }}'
        sequence:
          - action: switch.turn_on
            target:
              entity_id: '{{ cel_kapcsolo }}'
  - action: tts.speak
    target:
      entity_id: tts.google_ai_tts
    data:
      media_player_entity_id: '{{ cel_hangszoro }}'
      message: '{{ uzenet }}'
  - delay:
      seconds: 7
  - choose:
      - conditions:
          - condition: template
            value_template: '{{ cel_kapcsolo != '''' and states(cel_kapcsolo) is defined }}'
        sequence:
          - action: switch.turn_off
            target:
              entity_id: '{{ cel_kapcsolo }}'
            data: {}
  - choose:
      - conditions:
          - condition: template
            value_template: '{{ mpd_volt_e_aktiv }}'
        sequence:
          - action: media_player.play_media
            target:
              entity_id: media_player.music_player_daemon
            data:
              media:
                media_content_id: '{{ mpd_forras }}'
                media_content_type: music
                metadata: {}
  - action: automation.turn_on
    metadata: {}
    target:
      entity_id: automation.ido_bemondas
    data: {}
    enabled: true
mode: single
fields:
  uzenet:
    description: A bemondandó szöveg
    example: Üdvözlöm Laci úr, a kávé elkészült.
    required: true
    selector:
      text: null

“finomított univerzális helység alapú bemondás” bejegyzéshez 3 hozzászólás

  1. Just tried out this platform and the whole experience felt incredibly smooth from start to finish. The games load fast and customer support actually replies within minutes. Highly recommend giving it a spin if you want a hassle free gaming session. mywe88

    Válasz
  2. I’ve been trying a few different sites lately and this one really stands out. The interface is smooth and the payouts are surprisingly fast. Definitely recommend checking out lottusbet if you want a reliable spot.

    Válasz

Szólj hozzá!