2020-02-24 15:55:34 +00:00
|
|
|
# Provides:
|
|
|
|
# timer
|
|
|
|
# automation
|
|
|
|
# script
|
|
|
|
|
|
|
|
# Needs:
|
|
|
|
# sensor.zigbee_btn1_click
|
2021-05-15 11:13:13 +00:00
|
|
|
# notify.signal_home
|
2020-02-24 15:55:34 +00:00
|
|
|
let
|
|
|
|
button = "sensor.zigbee_btn2_click";
|
2021-05-15 11:13:13 +00:00
|
|
|
notify = "notify.signal_home";
|
2023-06-03 13:27:46 +00:00
|
|
|
# für {{ _intent.siteId }} - name of the rhasspy instance: arbeitszimmer
|
2020-11-18 21:23:33 +00:00
|
|
|
in
|
|
|
|
{
|
|
|
|
services.home-assistant.config = {
|
2023-06-03 13:27:46 +00:00
|
|
|
automation = [];
|
|
|
|
timer.kurzzeitwecker = {
|
|
|
|
name = "Wecker Wohnung";
|
2020-11-18 21:23:33 +00:00
|
|
|
};
|
2023-06-03 13:27:46 +00:00
|
|
|
timer.wecker_arbeitszimmer = {
|
|
|
|
name = "Wecker Arbeitszimmer";
|
2020-11-18 21:23:33 +00:00
|
|
|
};
|
2023-06-03 13:27:46 +00:00
|
|
|
timer.wecker_wohnzimmer = {
|
|
|
|
name = "Wecker Wohnzimmer";
|
|
|
|
};
|
|
|
|
intent = {};
|
|
|
|
intent_script = {
|
|
|
|
TimerjobStart = {
|
|
|
|
speech.text = ''
|
|
|
|
{% set h = hours|default('0')|string %}
|
|
|
|
{% set m = minutes|default('0')|string %}
|
|
|
|
{% if h == "0" %}
|
|
|
|
Wecker gestellt {{ m }} Minuten
|
|
|
|
{% elif m == "0" %}
|
|
|
|
Wecker gestellt {{ h }} Stunden
|
|
|
|
{% else %}
|
|
|
|
Wecker gestellt {{ h }} Stunden und {{ m }} Minuten
|
|
|
|
{% endif %}
|
|
|
|
'';
|
2020-11-18 21:23:33 +00:00
|
|
|
action = [
|
|
|
|
{
|
2023-06-03 13:27:46 +00:00
|
|
|
service = "timer.start";
|
|
|
|
|
|
|
|
data.entity_id = "timer.kurzzeitwecker";
|
|
|
|
data.duration = ''
|
|
|
|
{% set h = hours|default("0")|int %}
|
|
|
|
{% set m = minutes|default("0")|int %}
|
|
|
|
{{ "%02d" | format(h) }}:{{ "%02d" | format(m) }}:00
|
|
|
|
'';
|
2020-02-24 15:55:34 +00:00
|
|
|
|
2020-11-18 21:23:33 +00:00
|
|
|
}
|
|
|
|
];
|
2023-06-03 13:27:46 +00:00
|
|
|
};
|
|
|
|
TimerjobRemaining = {
|
|
|
|
speech.text = ''
|
|
|
|
{% set timer = states('timer.kurzzeitwecker') %}
|
|
|
|
{% if timer == 'idle' %}
|
|
|
|
Wecker läuft nicht
|
|
|
|
{% elif timer == 'active' %}
|
|
|
|
{% set remaining = as_timestamp( state_attr('timer.kurzzeitwecker','finishes_at') )-( as_timestamp(now())) %}
|
|
|
|
{% set s = ((remaining % 60)) | int %}
|
|
|
|
{% set m = ((remaining % 3600) / 60) | int %}
|
|
|
|
{% set h = ((remaining % 86400) / 3600) | int %}
|
|
|
|
{% if h == 0 %}
|
|
|
|
Es verbleiben {{ m }} Minuten und {{ s }} Sekunden
|
|
|
|
{% elif m == 0 %}
|
|
|
|
Es verbleiben {{ h }} Stunden
|
|
|
|
{% elif m == 0 and h == 0 %}
|
|
|
|
Es verbleiben {{ s }} Sekunden
|
|
|
|
{% else %}
|
|
|
|
Es verbleiben {{ h }} Stunden {{ m }} Minuten
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
TimerjobStop = {
|
|
|
|
speech.text = ''
|
|
|
|
Wecker gestoppt
|
|
|
|
'';
|
2020-11-18 21:23:33 +00:00
|
|
|
action = [
|
2023-06-03 13:27:46 +00:00
|
|
|
{ service = "timer.cancel";
|
|
|
|
data.entity_id = "timer.kurzzeitwecker";
|
2020-11-18 21:23:33 +00:00
|
|
|
}
|
|
|
|
];
|
2023-06-03 13:27:46 +00:00
|
|
|
};
|
|
|
|
};
|
2020-11-18 21:23:33 +00:00
|
|
|
};
|
2020-02-24 15:55:34 +00:00
|
|
|
}
|