2019-09-05 23:07:20 +00:00
|
|
|
let
|
2020-01-07 15:52:31 +00:00
|
|
|
glados = import ../lib;
|
2019-10-13 00:31:48 +00:00
|
|
|
seconds = 20;
|
2019-09-05 23:07:20 +00:00
|
|
|
in
|
|
|
|
{
|
|
|
|
switch = [
|
2020-01-10 08:59:11 +00:00
|
|
|
(glados.tasmota.plug { host = "Wasser"; topic = "plug";} )
|
2019-09-05 23:07:20 +00:00
|
|
|
];
|
2020-01-07 15:52:31 +00:00
|
|
|
|
2019-09-05 23:07:20 +00:00
|
|
|
automation =
|
|
|
|
[
|
2019-09-19 19:31:21 +00:00
|
|
|
{ alias = "Water the plant for ${toString seconds} seconds";
|
2019-09-05 23:07:20 +00:00
|
|
|
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"
|
|
|
|
];
|
|
|
|
}
|
2019-09-19 19:31:21 +00:00
|
|
|
{ delay.seconds = seconds; }
|
2019-09-05 23:07:20 +00:00
|
|
|
{
|
|
|
|
service = "homeassistant.turn_off";
|
|
|
|
entity_id = [
|
|
|
|
"switch.wasser"
|
|
|
|
];
|
|
|
|
}
|
|
|
|
];
|
|
|
|
}
|
2019-09-19 19:31:21 +00:00
|
|
|
{ alias = "Always turn off water after ${toString (seconds * 2)}seconds";
|
2019-09-05 23:07:20 +00:00
|
|
|
trigger = [
|
|
|
|
{
|
|
|
|
platform = "state";
|
|
|
|
entity_id = "switch.wasser";
|
|
|
|
to = "on";
|
2019-09-19 19:31:21 +00:00
|
|
|
for.seconds = seconds*2;
|
2019-09-05 23:07:20 +00:00
|
|
|
}
|
|
|
|
];
|
|
|
|
action =
|
|
|
|
[
|
|
|
|
{
|
|
|
|
service = "homeassistant.turn_off";
|
|
|
|
entity_id = [ "switch.wasser" ];
|
|
|
|
}
|
|
|
|
];
|
|
|
|
}
|
|
|
|
];
|
|
|
|
}
|