| 1 |
language: pl |
| 2 |
responses: |
| 3 |
intents: |
| 4 |
HassGetState: |
| 5 |
# DEFAULT ============================================================================================================================== |
| 6 |
default: | |
| 7 |
{% set vowelsList = ['e', 'i', 'o', 'u'] %} |
| 8 |
{% set lastChar = slots.name | default("y", false) | last %} |
| 9 |
{% if state.state_with_unit == 'open': %} |
| 10 |
{% if lastChar == "a" %}Otwarta{% elif lastChar in vowelsList %}Otwarte{% else %}Otwarty{% endif %} |
| 11 |
{% elif state.state_with_unit == 'closed': %} |
| 12 |
{% if lastChar == "a" %}Zamknięta{% elif lastChar in vowelsList %}Zamknięte{% else %}Zamknięty{% endif %} |
| 13 |
{% elif state.state_with_unit == 'on': %} |
| 14 |
{% if lastChar == "a" %}Włączona{% elif lastChar in vowelsList %}Włączone{% else %}Włączony{% endif %} |
| 15 |
{% elif state.state_with_unit == 'off': %} |
| 16 |
{% if lastChar == "a" %}Wyłączona{% elif lastChar in vowelsList %}Wyłączone{% else %}Wyłączony{% endif %} |
| 17 |
{% else %} |
| 18 |
{{ state.state_with_unit | replace(".", ",") if state.state|float(state.state) is number else state.state_with_unit }} |
| 19 |
{% endif %} |
| 20 |
|
| 21 |
# ONE ================================================================================================================================== |
| 22 |
one: | |
| 23 |
{% set vowelsList = ['e', 'i', 'o', 'u'] %} |
| 24 |
{% set lastChar = slots.name | last %} |
| 25 |
{{ slots.name | capitalize }} |
| 26 |
{% if state.state_with_unit == 'open': %} |
| 27 |
jest {% if lastChar == "a" %}otwarta{% elif lastChar in vowelsList %}otwarte{% else %}otwarty{% endif %} |
| 28 |
{% elif state.state_with_unit == 'closed': %} |
| 29 |
jest {% if lastChar == "a" %}zamknięta{% elif lastChar in vowelsList %}zamknięte{% else %}zamknięty{% endif %} |
| 30 |
{% elif state.state_with_unit == 'on': %} |
| 31 |
jest {% if lastChar == "a" %}włączona{% elif lastChar in vowelsList %}włączone{% else %}włączony{% endif %} |
| 32 |
{% elif state.state_with_unit == 'off': %} |
| 33 |
jest {% if lastChar == "a" %}wyłączona{% elif lastChar in vowelsList %}wyłączone{% else %}wyłączony{% endif %} |
| 34 |
{% else %} |
| 35 |
jest {{ state.state_with_unit | replace(".", ",") if state.state|float(state.state) is number else state.state_with_unit }} |
| 36 |
{% endif %} |
| 37 |
|
| 38 |
one_state: | |
| 39 |
{% set vowelsList = ['e', 'i', 'o', 'u'] %} |
| 40 |
{% set lastChar = slots.name | last %} |
| 41 |
Stan {{ slots.name | capitalize }} to |
| 42 |
{% if state.state_with_unit == 'open': %} |
| 43 |
{% if lastChar == "a" %}otwarta{% elif lastChar in vowelsList %}otwarte{% else %}otwarty{% endif %} |
| 44 |
{% elif state.state_with_unit == 'closed': %} |
| 45 |
{% if lastChar == "a" %}zamknięta{% elif lastChar in vowelsList %}zamknięte{% else %}zamknięty{% endif %} |
| 46 |
{% elif state.state_with_unit == 'on': %} |
| 47 |
{% if lastChar == "a" %}włączona{% elif lastChar in vowelsList %}włączone{% else %}włączony{% endif %} |
| 48 |
{% elif state.state_with_unit == 'off': %} |
| 49 |
{% if lastChar == "a" %}wyłączona{% elif lastChar in vowelsList %}wyłączone{% else %}wyłączony{% endif %} |
| 50 |
{% else %} |
| 51 |
{{ state.state_with_unit | replace(".", ",") if state.state|float(state.state) is number else state.state_with_unit }} |
| 52 |
{% endif %} |
| 53 |
|
| 54 |
one_status: | |
| 55 |
{% set vowelsList = ['e', 'i', 'o', 'u'] %} |
| 56 |
{% set lastChar = slots.name | last %} |
| 57 |
Status {{ slots.name | capitalize }} to |
| 58 |
{% if state.state_with_unit == 'open': %} |
| 59 |
{% if lastChar == "a" %}otwarta{% elif lastChar in vowelsList %}otwarte{% else %}otwarty{% endif %} |
| 60 |
{% elif state.state_with_unit == 'closed': %} |
| 61 |
{% if lastChar == "a" %}zamknięta{% elif lastChar in vowelsList %}zamknięte{% else %}zamknięty{% endif %} |
| 62 |
{% elif state.state_with_unit == 'on': %} |
| 63 |
{% if lastChar == "a" %}włączona{% elif lastChar in vowelsList %}włączone{% else %}włączony{% endif %} |
| 64 |
{% elif state.state_with_unit == 'off': %} |
| 65 |
{% if lastChar == "a" %}wyłączona{% elif lastChar in vowelsList %}wyłączone{% else %}wyłączony{% endif %} |
| 66 |
{% else %} |
| 67 |
{{ state.state_with_unit | replace(".", ",") if state.state|float(state.state) is number else state.state_with_unit }} |
| 68 |
{% endif %} |
| 69 |
|
| 70 |
one_value: | |
| 71 |
{% set vowelsList = ['e', 'i', 'o', 'u'] %} |
| 72 |
{% set lastChar = slots.name | last %} |
| 73 |
Wartość {{ slots.name | capitalize }} to |
| 74 |
{% if state.state_with_unit == 'open': %} |
| 75 |
{% if lastChar == "a" %}otwarta{% elif lastChar in vowelsList %}otwarte{% else %}otwarty{% endif %} |
| 76 |
{% elif state.state_with_unit == 'closed': %} |
| 77 |
{% if lastChar == "a" %}zamknięta{% elif lastChar in vowelsList %}zamknięte{% else %}zamknięty{% endif %} |
| 78 |
{% elif state.state_with_unit == 'on': %} |
| 79 |
{% if lastChar == "a" %}włączona{% elif lastChar in vowelsList %}włączone{% else %}włączony{% endif %} |
| 80 |
{% elif state.state_with_unit == 'off': %} |
| 81 |
{% if lastChar == "a" %}wyłączona{% elif lastChar in vowelsList %}wyłączone{% else %}wyłączony{% endif %} |
| 82 |
{% else %} |
| 83 |
{{ state.state_with_unit | replace(".", ",") if state.state|float(state.state) is number else state.state_with_unit }} |
| 84 |
{% endif %} |
| 85 |
|
| 86 |
one_yesno: | |
| 87 |
{% set vowelsList = ['e', 'i', 'o', 'u'] %} |
| 88 |
{% set lastChar = slots.name | last %} |
| 89 |
{% if query.matched: %} |
| 90 |
Tak |
| 91 |
{% else: %} |
| 92 |
Nie, {{ slots.name | capitalize }} jest |
| 93 |
{% if state.state_with_unit == 'open': %} |
| 94 |
{% if lastChar == "a" %}otwarta{% elif lastChar in vowelsList %}otwarte{% else %}otwarty{% endif %} |
| 95 |
{% elif state.state_with_unit == 'closed': %} |
| 96 |
{% if lastChar == "a" %}zamknięta{% elif lastChar in vowelsList %}zamknięte{% else %}zamknięty{% endif %} |
| 97 |
{% elif state.state_with_unit == 'on': %} |
| 98 |
{% if lastChar == "a" %}włączona{% elif lastChar in vowelsList %}włączone{% else %}włączony{% endif %} |
| 99 |
{% elif state.state_with_unit == 'off': %} |
| 100 |
{% if lastChar == "a" %}wyłączona{% elif lastChar in vowelsList %}wyłączone{% else %}wyłączony{% endif %} |
| 101 |
{% else %} |
| 102 |
{{ state.state_with_unit | replace(".", ",") if state.state|float(state.state) is number else state.state_with_unit }} |
| 103 |
{% endif %} |
| 104 |
{% endif %} |
| 105 |
|
| 106 |
# ANY ================================================================================================================================== |
| 107 |
any: | |
| 108 |
{% if query.matched %} |
| 109 |
{% set match = query.matched | map(attribute="name") | sort | list %} |
| 110 |
{% if match | length > 4 %} |
| 111 |
Tak, {{ match[:3] | join(", ") }} oraz {{ (match | length - 3) }} więcej |
| 112 |
{%- else -%} |
| 113 |
Tak, |
| 114 |
{% for name in match -%} |
| 115 |
{% if not loop.first and not loop.last %}, {% elif loop.last and not loop.first %} i {% endif -%} |
| 116 |
{{ name }} |
| 117 |
{%- endfor -%} |
| 118 |
{% endif %} |
| 119 |
{% else %} |
| 120 |
Nie |
| 121 |
{% endif %} |
| 122 |
|
| 123 |
# ALL ================================================================================================================================== |
| 124 |
# Explanation and Examples: |
| 125 |
# 1 drzwi nie są, 1 zasłona nie jest |
| 126 |
# 2 drzwi, zasłony nie są |
| 127 |
# 3 drzwi, zasłony nie są |
| 128 |
# 4 drzwi, zasłony nie są |
| 129 |
# 5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21 drzwi, zasłon nie jest |
| 130 |
# 22,23,24 zasłony drzwi nie są |
| 131 |
# 25,26,27,28,29,30,31 drzwi, zasłon nie jest |
| 132 |
# 32,33,34 drzwi, zasłony nie są |
| 133 |
# 35,36,37,38,39,40,41 drzwi, zasłon nie jest |
| 134 |
# 42,43,44 drzwi, zasłony nie są |
| 135 |
all: | |
| 136 |
{% if not query.unmatched: %} |
| 137 |
Tak |
| 138 |
{% else %} |
| 139 |
{% set no_match = query.unmatched | map(attribute="name") | sort | list %} |
| 140 |
{% if no_match | length > 4 %} |
| 141 |
Nie, {{ no_match[:3] | join(", ") }} oraz {{ (no_match | length - 3) }} nie ma już więcej |
| 142 |
{%- else -%} |
| 143 |
Nie, |
| 144 |
{% for name in no_match -%} |
| 145 |
{% if not loop.first and not loop.last %}, {% elif loop.last and not loop.first %} i {% endif -%} |
| 146 |
{{ name }} |
| 147 |
{%- endfor %} nie {% if state.attributes.device_class == "curtain" and no_match|length|int|abs == 1 -%}jest |
| 148 |
{%- elif state.attributes.device_class == "lock" and no_match|length|int|abs == 1 -%}jest |
| 149 |
{%- elif state.attributes.device_class == "door" and no_match|length|int|abs == 1 -%}są |
| 150 |
{%- else -%}{{ 'są' if no_match|length|int|abs == 1 else 'są' if no_match|length|int | abs in [2,3,4] else 'są' if (no_match|length|string)[-1] | int | abs in [2,3,4] else 'jest' }} |
| 151 |
{%- endif -%} |
| 152 |
{% endif %} |
| 153 |
{% endif %} |
| 154 |
|
| 155 |
# WHICH ================================================================================================================================ |
| 156 |
which: | |
| 157 |
{% if not query.matched %} |
| 158 |
{% if state.domain == "light" %} |
| 159 |
Żadne |
| 160 |
{% elif state.attributes and state.attributes.device_class %} |
| 161 |
{% if state.attributes.device_class in "shade" %} |
| 162 |
Żadna osłona nie jest {% if state.hass_state == "open" %}zamknięta{% else %}otwarta{% endif %} |
| 163 |
{% elif state.attributes.device_class == "blind" %} |
| 164 |
Żadna roleta nie jest {% if state.hass_state == "open" %}zamknięta{% else %}otwarta{% endif %} |
| 165 |
{% elif state.attributes.device_class == "curtain" %} |
| 166 |
Żadna zasłona nie jest {% if state.hass_state == "open" %}zamknięta{% else %}otwarta{% endif %} |
| 167 |
{% elif state.attributes.device_class == "shutter" %} |
| 168 |
Żadna żaluzja nie jest {% if state.hass_state == "open" %}zamknięta{% else %}otwarta{% endif %} |
| 169 |
{% elif state.attributes.device_class == "garage" %} |
| 170 |
Żaden garaż nie jest {% if state.hass_state == "open" %}zamknięty{% else %}otwarty{% endif %} |
| 171 |
{% elif state.attributes.device_class == "gate" %} |
| 172 |
Żadna brama nie jest {% if state.hass_state == "open" %}zamknięta{% else %}otwarta{% endif %} |
| 173 |
{% elif state.attributes.device_class == "door" %} |
| 174 |
Żadne drzwi nie są {% if state.hass_state == "open" %}zamknięte{% else %}otwarte{% endif %} |
| 175 |
{% elif state.attributes.device_class == "damper" %} |
| 176 |
Żadna klapa nie jest {% if state.hass_state == "open" %}zamknięta{% else %}otwarta{% endif %} |
| 177 |
{% elif state.attributes.device_class == "awning" %} |
| 178 |
Żadna markiza nie jest {% if state.hass_state == "open" %}zamknięta{% else %}otwarta{% endif %} |
| 179 |
{% elif state.attributes.device_class == "window" %} |
| 180 |
Żadne okno nie jest {% if state.hass_state == "open" %}zamknięte{% else %}otwarte{% endif %} |
| 181 |
{% endif %} |
| 182 |
{% else %} |
| 183 |
Żadna |
| 184 |
{% endif %} |
| 185 |
{% else: %} |
| 186 |
{% set match = query.matched | map(attribute="name") | sort | list %} |
| 187 |
{% if match | length > 4 %} |
| 188 |
{{ match[:3] | join(", ") }} oraz {{ (match | length - 3) }} inne |
| 189 |
{% else %} |
| 190 |
{%- for name in match -%} |
| 191 |
{% if not loop.first and not loop.last %}, {% elif loop.last and not loop.first %} i {% endif -%} |
| 192 |
{{ name }} |
| 193 |
{%- endfor -%} |
| 194 |
{% endif %} |
| 195 |
{% endif %} |
| 196 |
|
| 197 |
# HOW MANY ============================================================================================================================= |
| 198 |
how_many: | |
| 199 |
{{ query.matched | length }} |
| 200 |
|
| 201 |
# WHERE ================================================================================================================================ |
| 202 |
where: | |
| 203 |
{% if state.state == "home" %} |
| 204 |
{{ slots.name | capitalize }} jest w domu |
| 205 |
{% elif state.state == "not_home" %} |
| 206 |
{{ slots.name | capitalize }} jest poza domem |
| 207 |
{% else %} |
| 208 |
{{ slots.name | capitalize }} jest w {{ state.state }} |
| 209 |
{% endif %} |