blob: a2c80851b38fa07a5009e3571ffd47bd9649adbf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
let
tasmota_plug = name: topic:
{ platform = "mqtt";
inherit name;
state_topic = "sonoff/stat/${topic}/POWER1";
command_topic = "sonoff/cmnd/${topic}/POWER1";
availability_topic = "sonoff/tele/${topic}/LWT";
payload_on= "ON";
payload_off= "OFF";
payload_available= "Online";
payload_not_available= "Offline";
retain = false;
qos = 1;
};
in
{
switch = [
(tasmota_plug "Wasser" "plug")
];
automation =
[
{ alias = "Water the plant for 10 seconds";
trigger = [
{ # trigger at 20:00 no matter what
# TODO: retry or run only if switch.wasser is available
platform = "time";
at = "20:00:00";
}
];
action =
[
{
service = "homeassistant.turn_on";
entity_id = [
"switch.wasser"
];
}
{ delay.seconds = 10; }
{
service = "homeassistant.turn_off";
entity_id = [
"switch.wasser"
];
}
];
}
{ alias = "Always turn off water after 15 seconds";
trigger = [
{
platform = "state";
entity_id = "switch.wasser";
to = "on";
for.seconds = 15;
}
];
action =
[
{
service = "homeassistant.turn_off";
entity_id = [ "switch.wasser" ];
}
];
}
];
}
|