Skip to content

Commit a09cd8e

Browse files
authored
[SL] Binary sensors - sentences, test, responses (#1724)
* BS added, response adjusted, broken lock, cover and fixed * fixed cover_HassTurnOn blinds * added carbon monoxide sensor to binary_sensor_Hass * small fix in fxtures bsHassGetState * carbon monoxide bs * added binary sensors (cold, connectivity, door, garage door), supplementary response for bs * co2 * cold, connectivity, door, garage door * fixed after resolving some conflicts
1 parent df379f9 commit a09cd8e

5 files changed

Lines changed: 295 additions & 2 deletions

File tree

responses/sl/HassGetState.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,20 @@ responses:
6363
{%- endfor -%}
6464
{% endif %}
6565
{% endif %}
66-
66+
which_bs: |
67+
{% if not query.matched %}
68+
Noben
69+
{% else: %}
70+
{% set match = query.matched | map(attribute="name") | sort | list %}
71+
{% if match | length > 4 %}
72+
{{ match[:3] | join(", ") }} and {{ (match | length - 3) }} more
73+
{% else %}
74+
{%- for name in match -%}
75+
{% if not loop.first and not loop.last %}, {% elif loop.last and not loop.first %} and {% endif -%}
76+
{{ name }}
77+
{%- endfor -%}
78+
{% endif %}
79+
{% endif %}
6780
how_many: |
6881
{{ query.matched | length }}
6982

sentences/sl/_common.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,33 @@ lists:
134134
- in: "čisto"
135135
out: "off"
136136

137+
bs_cold_states:
138+
values:
139+
- in: "([zaznano] hladn(e|o|a)|[zaznano] mrzl(o|e|a|i))"
140+
out: "on"
141+
- in: "normaln(e|o|a|i)"
142+
out: "off"
143+
144+
bs_connectivity_states:
145+
values:
146+
- in: "priključen[a|e|i|ih]"
147+
out: "on"
148+
- in: "izključen[a|e|i|ih]"
149+
out: "off"
150+
151+
bs_door_states:
152+
values:
153+
- in: "odprt(a|e|i|ih|o)"
154+
out: "on"
155+
- in: "zaprt(a|e|i|o|ih)"
156+
out: "off"
157+
158+
bs_garage_door_states:
159+
values:
160+
- in: "odprt(a|e|i|ih|o)"
161+
out: "on"
162+
- in: "zaprt(a|e|i|o|ih)"
163+
out: "off"
137164
expansion_rules:
138165
name: "{name}"
139166
area: "[v | na] {area}[sob[o|e|i|ah]| prostor[u||e|a|ih]| kuhinj(i|a|skem|ski|ske|sko) [prosto[r|ru|re|rih]]| dnevn(a|i|em|ih) [prostor[u|ih]]| dnevn(i|a) sob(i|a)| spalni(ca|ci)]| zuna(nja|j)| lop(a|i)| ut(a|i)| dvorišč(e|u|na|ni)| teras(i|e|a)"

sentences/sl/binary_sensor_HassGetState.yaml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,99 @@ intents:
129129
slots:
130130
domain: binary_sensor
131131
device_class: carbon_monoxide
132+
133+
# Cold
134+
- sentences:
135+
- "([ali] so|[ali] je) <name> {bs_cold_states:state} [[v|na] <area>]"
136+
response: one_yesno
137+
requires_context:
138+
domain: binary_sensor
139+
device_class: cold
140+
slots:
141+
domain: binary_sensor
142+
device_class: cold
143+
144+
- sentences:
145+
- "([ali] so|[ali] je) (kateri senzor| kaj) [zazna[l|no]|detektiral] (hlad[en|no]|mrz[el|lo]) [[v|na] <area>]"
146+
response: any
147+
slots:
148+
domain: binary_sensor
149+
device_class: cold
150+
state: "on"
151+
152+
- sentences:
153+
- "[[ali] je|[ali] so] kateri senzor[ji] [je|so] [zaznal|detektiral] (hlad[ni|en|no]| mrz[li|el|lo]) [[v|na] <area>]"
154+
response: which_bs
155+
slots:
156+
domain: binary_sensor
157+
device_class: cold
158+
state: "on"
159+
160+
- sentences:
161+
- "koliko senzorjev je [zaznalo|detektiralo] (mrzl[o|ih]| hladn[o|ih]) [[v|na] <area>]"
162+
response: how_many
163+
slots:
164+
domain: binary_sensor
165+
device_class: cold
166+
state: "on"
167+
168+
# Connectivity
169+
- sentences:
170+
- "([ali] je|[ali] so) <name> {bs_connectivity_states:state} [[v|na] <area>]"
171+
response: one_yesno
172+
requires_context:
173+
domain: binary_sensor
174+
device_class: connectivity
175+
slots:
176+
domain: binary_sensor
177+
device_class: connectivity
178+
179+
- sentences:
180+
- "([ali] je|[ali] so) katera naprav(a|e) {bs_connectivity_states:state} [[v|na] <area>]"
181+
response: any
182+
slots:
183+
domain: binary_sensor
184+
device_class: connectivity
185+
186+
- sentences:
187+
- "[ali] so [vse] naprave {bs_connectivity_states:state} [[v|na] <area>]"
188+
response: all
189+
slots:
190+
domain: binary_sensor
191+
device_class: connectivity
192+
193+
- sentences:
194+
- "kater(e|a|i) naprav(e|a|i) (je|sta|so) {bs_connectivity_states:state} [[v|na] <area>]"
195+
response: which
196+
slots:
197+
domain: binary_sensor
198+
device_class: connectivity
199+
200+
- sentences:
201+
- "koliko naprav je {bs_connectivity_states:state} [[v|na] <area>]"
202+
response: how_many
203+
slots:
204+
domain: binary_sensor
205+
device_class: connectivity
206+
207+
# Door
208+
- sentences:
209+
- "([ali] so) <name> {bs_door_states:state} [[v|na] <area>]"
210+
response: one_yesno
211+
requires_context:
212+
domain: binary_sensor
213+
device_class: door
214+
slots:
215+
domain: binary_sensor
216+
device_class: door
217+
218+
# Garage door
219+
- sentences:
220+
- "([ali] so) <name> {bs_garage_door_states:state} [[v|na] <area>]"
221+
response: one_yesno
222+
requires_context:
223+
domain: binary_sensor
224+
device_class: garage_door
225+
slots:
226+
domain: binary_sensor
227+
device_class: garage_door

tests/sl/_fixtures.yaml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ entities:
250250
state: "ni doma"
251251

252252
# https://www.home-assistant.io/integrations/binary_sensor/
253-
- name: "telefona"
253+
- name: "telefon[a]"
254254
id: "binary_sensor.phone_battery"
255255
state:
256256
in: "normalna"
@@ -289,3 +289,35 @@ entities:
289289
out: "off"
290290
attributes:
291291
device_class: carbon_monoxide
292+
293+
- name: "vodovodne cevi"
294+
id: "binary_sensor.computer_cold"
295+
state:
296+
in: "normalne"
297+
out: "off"
298+
attributes:
299+
device_class: cold
300+
301+
- name: "telefon"
302+
id: "binary_sensor.phone_connectivity"
303+
state:
304+
in: "priključen"
305+
out: "on"
306+
attributes:
307+
device_class: connectivity
308+
309+
- name: "vrata za hišne ljubljenčke"
310+
id: "binary_sensor.pet_door"
311+
state:
312+
in: "zaprta"
313+
out: "off"
314+
attributes:
315+
device_class: door
316+
317+
- name: "pomožna garažna vrata"
318+
id: "binary_sensor.garage_door"
319+
state:
320+
in: "zaprta"
321+
out: "off"
322+
attributes:
323+
device_class: garage_door

tests/sl/binary_sensor_HassGetState.yaml

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,3 +250,128 @@ tests:
250250
device_class: carbon_monoxide
251251
state: "on"
252252
response: "0"
253+
254+
# Cold
255+
- sentences:
256+
- "ali so vodovodne cevi hladne?"
257+
intent:
258+
name: HassGetState
259+
slots:
260+
domain: "binary_sensor"
261+
device_class: "cold"
262+
name: "vodovodne cevi"
263+
state: "on"
264+
response: "Ne, normalne"
265+
266+
- sentences:
267+
- "je kaj zaznano hladno?"
268+
- "ali je kateri senzor zaznal hladno?"
269+
- "ali je kaj zaznano mrzlo?"
270+
intent:
271+
name: HassGetState
272+
slots:
273+
domain: binary_sensor
274+
device_class: cold
275+
state: "on"
276+
response: "Ne"
277+
278+
- sentences:
279+
- "kateri senzor je zaznal hladno?"
280+
- "kateri senzor je detektiral mrzlo?"
281+
intent:
282+
name: HassGetState
283+
slots:
284+
domain: binary_sensor
285+
device_class: cold
286+
state: "on"
287+
response: "Noben"
288+
289+
- sentences:
290+
- "koliko senzorjev je mrzlih?"
291+
- "koliko senzorjev je hladnih?"
292+
- "koliko senzorjev je zaznalo hladno?"
293+
- "koliko senzorjev je detektiralo mrzlo?"
294+
intent:
295+
name: HassGetState
296+
slots:
297+
domain: binary_sensor
298+
device_class: cold
299+
state: "on"
300+
response: "0"
301+
302+
# Connectivity
303+
- sentences:
304+
- "ali je telefon priključen?"
305+
intent:
306+
name: HassGetState
307+
slots:
308+
domain: "binary_sensor"
309+
device_class: "connectivity"
310+
name: "telefon"
311+
state: "on"
312+
response: "Da"
313+
314+
- sentences:
315+
- "ali je katera naprava priključena?"
316+
intent:
317+
name: HassGetState
318+
slots:
319+
domain: binary_sensor
320+
device_class: connectivity
321+
state: "on"
322+
response: "Da, telefon"
323+
324+
- sentences:
325+
- "ali so vse naprave priključene?"
326+
intent:
327+
name: HassGetState
328+
slots:
329+
domain: binary_sensor
330+
device_class: connectivity
331+
state: "on"
332+
response: "Da"
333+
334+
- sentences:
335+
- "katera naprava je priključena?"
336+
intent:
337+
name: HassGetState
338+
slots:
339+
domain: binary_sensor
340+
device_class: connectivity
341+
state: "on"
342+
response: "telefon"
343+
344+
- sentences:
345+
- "koliko naprav je priključenih?"
346+
intent:
347+
name: HassGetState
348+
slots:
349+
domain: binary_sensor
350+
device_class: connectivity
351+
state: "on"
352+
response: "1"
353+
354+
# Door
355+
- sentences:
356+
- "ali so vrata za hišne ljubljenčke odprta?"
357+
- "so vrata za hišne ljubljenčke odprta?"
358+
intent:
359+
name: HassGetState
360+
slots:
361+
domain: "binary_sensor"
362+
device_class: "door"
363+
name: "vrata za hišne ljubljenčke"
364+
state: "on"
365+
response: "Ne, zaprta"
366+
367+
# Garage door
368+
- sentences:
369+
- "ali so pomožna garažna vrata zaprta?"
370+
intent:
371+
name: HassGetState
372+
slots:
373+
domain: "binary_sensor"
374+
device_class: "garage_door"
375+
name: "pomožna garažna vrata"
376+
state: "off"
377+
response: "Da"

0 commit comments

Comments
 (0)