Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass entity untranslated state to sentences #1848

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
35 changes: 35 additions & 0 deletions responses/de/HassGetState.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ responses:
Nein
{% endif %}

einzeln_zone: |
{% if query.matched %}
Ja
{% else %}
Nein, ist
{% if state.attributes.get("untranslated_state") in ["not_home", "home"] %}
{{ state.state }}
{% else %}
im Bereich {{ state.state_with_unit }}
{% endif %}
{% endif %}

irgendeins: |
{% if query.matched %}
{% set match = query.matched | map(attribute="name") | sort | list %}
Expand Down Expand Up @@ -59,5 +71,28 @@ responses:
{% endif %}
{% endif %}

wer: |
{% if not query.matched %}
Niemand
{% else: %}
{% set match = query.matched | map(attribute="name") | sort | list %}
{% if match | length > 4 %}
{{ match[:3] | join(", ") }} und {{ (match | length - 3) }} weitere
{% else %}
{%- for name in match -%}
{% if not loop.first and not loop.last %}, {% elif loop.last and not loop.first %} und {% endif -%}
{{ name }}
{%- endfor -%}
{% endif %}
{% endif %}

wie_viele: |
{{ query.matched | length }}

wo: |
{{ slots.name | capitalize }} ist
{% if state.attributes.get("untranslated_state") in ["not_home", "home"] %}
{{ state.state }}
{% else %}
im Bereich {{ state.state }}
{% endif %}
2 changes: 1 addition & 1 deletion responses/de/HassGetWeather.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ responses:
'windy': 'und windig',
'windy-variant': 'mit Wind und Wolken'
} %}
{{ state.attributes.get('temperature') }} {{ state.attributes.get('temperature_unit') }} {{ weather_condition.get((state.state | string).lower(), "") }}
{{ state.attributes.get('temperature') }} {{ state.attributes.get('temperature_unit') }} {{ weather_condition.get((state.attributes.get('untranslated_state') | string).lower(), "") }}
60 changes: 57 additions & 3 deletions responses/en/HassGetState.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ responses:
No, {{ state.state_with_unit }}
{% endif %}

someone_yesno: |
{% if query.matched %}
Yes
{% else %}
No,
{% if state.attributes.get("untranslated_state") == "not_home" %}
{{ state.state }}
{% else %}
at {{ state.state }}
{% endif %}
{% endif %}

any: |
{% if query.matched %}
{% set match = query.matched | map(attribute="name") | sort | list %}
Expand Down Expand Up @@ -48,6 +60,32 @@ responses:
{% endif %}
{% endif %}

everybody: |
{% if not query.unmatched: %}
Yes
{% else %}
{% set no_match = query.unmatched | map(attribute="name") | sort | list %}
{% if no_match | length > 4 %}
No, {{ no_match[:3] | join(", ") }} and {{ (no_match | length - 3) }} more are not
{% if state.attributes.get("untranslated_state") == "not_home" %}
{{ state.state }}
{% else %}
at {{ state.state }}
{% endif %}
{%- else -%}
No,
{% for name in no_match -%}
{% if not loop.first and not loop.last %}, {% elif loop.last and not loop.first %} and {% endif -%}
{{ name }}
{%- endfor %} {% if no_match | length > 1 %}are{% else %}is{% endif %} not
{% if state.attributes.get("untranslated_state") == "not_home" %}
{{ state.state }}
{% else %}
at {{ state.state }}
{% endif %}
{% endif %}
{% endif %}

which: |
{% if not query.matched %}
Not any
Expand All @@ -63,12 +101,28 @@ responses:
{% endif %}
{% endif %}

who: |
{% if not query.matched %}
Nobody
{% else: %}
{% set match = query.matched | map(attribute="name") | sort | list %}
{% if match | length > 4 %}
{{ match[:3] | join(", ") }} and {{ (match | length - 3) }} others
{% else %}
{%- for name in match -%}
{% if not loop.first and not loop.last %}, {% elif loop.last and not loop.first %} and {% endif -%}
{{ name }}
{%- endfor -%}
{% endif %}
{% endif %}

how_many: |
{{ query.matched | length }}

where: |
{% if state == "not_home" %}
{{ slots.name | capitalize }} is away
{{ slots.name | capitalize }} is
{% if state.attributes.get("untranslated_state") == "not_home" %}
{{ state.state }}
{% else %}
{{ slots.name | capitalize }} is at {{ state.state }}
at {{ state.state }}
{% endif %}
2 changes: 1 addition & 1 deletion responses/en/HassGetWeather.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ responses:
'windy': 'and windy',
'windy-variant': 'with wind and clouds'
} %}
{{ state.attributes.get('temperature') }} {{ state.attributes.get('temperature_unit') }} {{ weather_condition.get((state.state | string).lower(), "") }}
{{ state.attributes.get('temperature') }} {{ state.attributes.get('temperature_unit') }} {{ weather_condition.get((state.attributes.get('untranslated_state') | string).lower(), "") }}
70 changes: 62 additions & 8 deletions responses/es/HassGetState.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ responses:
{% endif %}
{% endif %}

someone_yesno: |
{% if query.matched %}
{% else %}
No, está
{% if state.attributes.get("untranslated_state") == "not_home" %}
{{ state.state }}
{% else %}
en {{ state.state }}
{% endif %}
{% endif %}

any: |
{% if query.matched %}
{% set match = query.matched | map(attribute="name") | sort | list %}
Expand Down Expand Up @@ -54,11 +66,7 @@ responses:
{% else %}
{% set no_match = query.unmatched | map(attribute="name") | sort | list %}
{% if no_match | length > 4 %}
{% if state.domain == "person" %}
No, ni {{ no_match[:3] | join(", ni ") }} ni otros {{ (no_match | length - 3) }} están en {{slots.state}}
{% else %}
No, ni {{ no_match[:3] | join(", ni ") }} ni otros {{ (no_match | length - 3) }} dispositivos tienen ese estado
{% endif %}
No, ni {{ no_match[:3] | join(", ni ") }} ni otros {{ (no_match | length - 3) }} dispositivos tienen ese estado
{% else %}
{% if no_match | length == 1 %}
{% if state.domain == "person" %}
Expand All @@ -81,6 +89,36 @@ responses:
{% endif %}
{% endif %}

everybody: |
{% if not query.unmatched: %}
{% else %}
{% set no_match = query.unmatched | map(attribute="name") | sort | list %}
{% if no_match | length > 4 %}
No, ni {{ no_match[:3] | join(", ni ") }} ni otros {{ (no_match | length - 3) }} están
{% if state.attributes.get("untranslated_state") == "not_home" %}
{{ state.state }}
{% else %}
en {{ state.state }}
{% endif %}
{%- else -%}
{% if no_match | length == 1 %}
No, {{ no_match|first }} no está
{% else %}
No, ni
{% for name in no_match -%}
{% if not loop.first and not loop.last %}, ni {% elif loop.last and not loop.first %} ni {% endif -%}
{{ name }}
{%- endfor %} están
{% endif %}
{% if state.attributes.get("untranslated_state") == "not_home" %}
{{ state.state }}
{% else %}
en {{ state.state }}
{% endif %}
{% endif %}
{% endif %}

which: |
{% if not query.matched %}
Ningún dispositivo
Expand All @@ -96,12 +134,28 @@ responses:
{% endif %}
{% endif %}

who: |
{% if not query.matched %}
Nadie
{% else: %}
{% set match = query.matched | map(attribute="name") | sort | list %}
{% if match | length > 4 %}
{{ match[:3] | join(", ") }} y otros {{ (match | length - 3) }} más
{% else %}
{%- for name in match -%}
{% if not loop.first and not loop.last %}, {% elif loop.last and not loop.first %} y {% endif -%}
{{ name }}
{%- endfor -%}
{% endif %}
{% endif %}

how_many: |
{{ query.matched | length }}

where: |
{% if state == "not_home" %}
{{ slots.name | capitalize }} está fuera
{{ slots.name | capitalize }} está
{% if state.attributes.get("untranslated_state") == "not_home" %}
{{ state.state }}
{% else %}
{{ slots.name | capitalize }} está en {{ state.state }}
en {{ state.state }}
{% endif %}
7 changes: 6 additions & 1 deletion responses/es/HassGetWeather.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,9 @@ responses:
'windy': 'Vientos',
'windy-variant': 'Vientos y nubes'
} %}
{{ weather_condition.get((state.state | string).lower(), "") }}, con una temperatura de {{ state.attributes.get('temperature') }} {{ state.attributes.get('temperature_unit') }}
{{ weather_condition.get((state.attributes.get('untranslated_state') | string).lower(), "") }}, con una temperatura de
{% if state.attributes.get('temperature') | int < 0 %}
{{ (state.attributes.get('temperature')|float |abs|string).rstrip('.0') }} {{ state.attributes.get('temperature_unit') }} bajo cero
{% else %}
{{ state.attributes.get('temperature') }} {{ state.attributes.get('temperature_unit') }}
{% endif %}
4 changes: 3 additions & 1 deletion responses/hu/HassClimateGetTemperature.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ language: hu
responses:
intents:
HassClimateGetTemperature:
default: "{{ state.state }} fok van"
default: >
{% set temperature = state_attr(state.entity_id, 'current_temperature') %}
{{ temperature }} fok
2 changes: 1 addition & 1 deletion responses/hu/HassClimateSetTemperature.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ language: hu
responses:
intents:
HassClimateSetTemperature:
default: "A hőmérséklet {{ slots.temperature }} fokra állítva."
default: "Hőmérséklet beállítva"
111 changes: 110 additions & 1 deletion responses/hu/HassGetState.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,113 @@
language: hu
responses:
intents:
HassGetState: {}
HassGetState:
default: "{{ state.state_with_unit }}" # leginkább egyéni mondatokhoz használva

# a visszaadott nevek száma maximum 4, ha több van, az első 3 név és a maradék szám kerül visszaadásra
# 4 vagy kevesebb név esetén a nevek vesszővel ", " vannak összekötve, és az utolsó név "és" szóval

one: |
{{ slots.name | capitalize }} értéke: {{ state.state_with_unit }}

one_yesno: |
{% if query.matched %}
Igen
{% else %}
Nem
{% endif %}

any: |
{% if query.matched %}
{% set match = query.matched | map(attribute="name") | sort | list %}
{% if match | length > 4 %}
Igen, {{ match[:3] | join(", ") }} és további {{ (match | length - 3) }} db
{%- else -%}
Igen,
{% for name in match -%}
{% if not loop.first and not loop.last %}, {% elif loop.last and not loop.first %} és {% endif -%}
{{ name }}
{%- endfor -%}
{% endif %}
{% else %}
Nem
{% endif %}

all: |
{% if not query.unmatched: %}
Igen
{% else %}
{% set no_match = query.unmatched | map(attribute="name") | sort | list %}
{% if no_match | length > 4 %}
Nem, {{ no_match[:3] | join(", ") }} és további {{ (no_match | length - 3) }} db nincs ebben az állapotban
{%- else -%}
Nem,
{% for name in no_match -%}
{% if not loop.first and not loop.last %}, {% elif loop.last and not loop.first %} és {% endif -%}
{{ name }}
{%- endfor %} {% if no_match | length > 1 %} {% else %} {% endif %} nincs ebben az állapotban
{% endif %}
{% endif %}

which: |
{% if not query.matched %}
Egyik sem
{% else: %}
{% set match = query.matched | map(attribute="name") | sort | list %}
{% if match | length > 4 %}
{{ match[:3] | join(", ") }} és további {{ (match | length - 3) }} db
{% else %}
{%- for name in match -%}
{% if not loop.first and not loop.last %}, {% elif loop.last and not loop.first %} és {% endif -%}
{{ name }}
{%- endfor -%}
{% endif %}
{% endif %}

how_many: |
{{ query.matched | length }}

where: |
{% if state.attributes.get("untranslated_state") == "home" %}
{{ slots.name | capitalize }} otthon van
{% elif state.attributes.get("untranslated_state") == 'not_home' or state.state == 'away' %}
{{ slots.name | capitalize }} távol van
{% else %}
{{ slots.name | capitalize }} itt van: {{ state.state }}
{% endif %}

one_yesno_where: |
{% if query.matched %}
Igen
{% else %}
{% if state.attributes.get("untranslated_state") == 'home' %}
Nem, otthon van
{% elif state.attributes.get("untranslated_state") == 'not_home' or state.state == 'away' %}
Nem, távol van
{% else %}
Nem, itt van: {{ state.state }}
{% endif %}
{% endif %}

all_where: |
{% if not query.unmatched %}
Igen
{% else %}
{% set no_match = query.unmatched | map(attribute="name") | sort | list %}
{% if no_match | length > 4 %}
Nem, {{ no_match[:3] | join(", ") }} és további {{ (no_match | length - 3) }} nincs a zónában
{%- else -%}
Nem,
{% for name in no_match -%}
{% if not loop.first and not loop.last %}, {% elif loop.last and not loop.first %} és {% endif -%}
{{ name }}
{%- endfor %}
{% if state.attributes.get("untranslated_state") == "home" %}
nincs otthon
{% elif state.attributes.get("untranslated_state") == 'not_home' or state.state == 'away' %}
távol van
{% else %}
nem ebben a zónában van: {{ state.state }}
{% endif %}
{% endif %}
{% endif %}
Loading