Skip to content

Commit

Permalink
fixes for weather and person state
Browse files Browse the repository at this point in the history
  • Loading branch information
andrejs2 committed Jan 3, 2024
1 parent 36c5f5c commit cf6b3ca
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 23 deletions.
27 changes: 18 additions & 9 deletions responses/sl/HassGetState.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,25 @@ responses:
Da
{% else %}
{% set no_match = query.unmatched | map(attribute="name") | sort | list %}
Ne,
{% if 'vrata' in no_match %}
{{ no_match[:-1] | join(' ') }} niso
{%- else %}
{{ no_match[-1] }} ni
{% if no_match | length > 4 %}
Ne, {{ no_match[:3] | join(", ") }} in {{ (no_match | length - 3) }} niso
{% if state.attributes.get("untranslated_state") == "not_home" %}
{{ state.state }}
{% else %}
v {{ state.state }}
{% endif %}
{%- else -%}
Ne,
{% for name in no_match -%}
{% if not loop.first and not loop.last %}, {% elif loop.last and not loop.first %} in {% endif -%}
{{ name }}
{%- endfor %} {% if no_match | length > 1 %}in{% else %} {% endif %} niso
{% if state.attributes.get("untranslated_state") == "not_home" %}
{{ state.state }}
{% else %}
{{ state.state }}
{% endif %}
{% endif %}
{% for name in no_match[0:-1] -%}
{% if not loop.first %}, {% endif -%}
{{ name }}
{%- endfor %}
{% endif %}
which: |
{% if not query.matched %}
Expand Down
22 changes: 13 additions & 9 deletions tests/sl/_fixtures.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -224,35 +224,39 @@ entities:
- name: "sesaj|posesaj kuhinjo"
id: "script.vacuum_clean_kitchen"

- name: "v Mariboru"
- name: "Maribor[u ]"
id: "weather.maribor"
state: "deževno"
state: "rainy"
attributes:
temperature: "21"
temperature_unit: "stopinj"

- name: "opravila|opravilom"
id: "todo.opravila"
state: ""

- name: "v Benetkah"
- name: "Benetk[e|ah]"
id: "weather.benetke"
state: "jasno"
state: "clear"
attributes:
temperature: "28"
temperature_unit: "stopinj"

- name: "opravila|opravilom"
id: "todo.opravila"
state: ""

- name: "Lev"
id: "person.Lev"
state: "doma"
attributes:
untranslated_state: "home"

- name: "Arya"
id: "person.arya"
state: "v službi"

- name: "Jon"
id: "person.jon"
state: "ni doma"
state: "proč"
attributes:
untranslated_state: "not_home"

# https://www.home-assistant.io/integrations/binary_sensor/
- name: "telefon[a]"
Expand Down
2 changes: 1 addition & 1 deletion tests/sl/binary_sensor_HassGetState.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ tests:
domain: binary_sensor
device_class: opening
state: "on"
response: "Ne, vrata lope ni"
response: "Ne, vrata lope niso zaprta"

- sentences:
- "kaj je odprto?"
Expand Down
8 changes: 4 additions & 4 deletions tests/sl/weather_HassGetWeather.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ tests:
intent:
name: HassGetWeather
slots:
name: v Mariboru
response: 21 stopinj in deževno
name: Mariboru
response: 21 stopinj

- sentences:
- "kakšno je vreme v Benetkah"
intent:
name: HassGetWeather
slots:
name: v Benetkah
response: 28 stopinj in jasno
name: Benetkah
response: 28 stopinj

0 comments on commit cf6b3ca

Please sign in to comment.