shack/glados: add shack-startup
This commit is contained in:
parent
6508c853da
commit
c12411d79f
|
@ -6,12 +6,13 @@
|
||||||
platform = "homeassistant";
|
platform = "homeassistant";
|
||||||
event = "start";
|
event = "start";
|
||||||
};
|
};
|
||||||
|
# trigger good/bad air
|
||||||
action = [
|
action = [
|
||||||
{ service = "light.turn_on";
|
{ service = "light.turn_on";
|
||||||
data = {
|
data = {
|
||||||
entity_id = "light.fablab_led";
|
entity_id = "light.fablab_led";
|
||||||
effect = "Rainbow";
|
effect = "Rainbow";
|
||||||
color_name = "yellow";
|
color_name = "purple";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
82
krebs/2configs/shack/glados/automation/shack-startup.nix
Normal file
82
krebs/2configs/shack/glados/automation/shack-startup.nix
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
# needs:
|
||||||
|
# binary_sensor.portal_lock
|
||||||
|
# sensor.keyholder
|
||||||
|
# media_player.lounge
|
||||||
|
let
|
||||||
|
glados = import ../lib;
|
||||||
|
in
|
||||||
|
[
|
||||||
|
{
|
||||||
|
alias = "Greet new keyholder for key exchange";
|
||||||
|
initial_state = true;
|
||||||
|
trigger = {
|
||||||
|
platform = "state";
|
||||||
|
entity_id = "sensor.keyholder";
|
||||||
|
};
|
||||||
|
condition = {
|
||||||
|
condition = "template";
|
||||||
|
value_template = "{{ trigger.from_state.state != 'No Keyholder' }}";
|
||||||
|
};
|
||||||
|
#action = glados.say.lounge "Danke {{trigger.to_state.state}} für das Übernehmen des Keys von {{trigger.from_state.state}}";
|
||||||
|
action = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
alias = "Start Music on portal lock on";
|
||||||
|
# TODO: use "power" trigger
|
||||||
|
trigger = {
|
||||||
|
platform = "state";
|
||||||
|
entity_id = "binary_sensor.portal_lock";
|
||||||
|
to = "on";
|
||||||
|
for.seconds = 30;
|
||||||
|
};
|
||||||
|
condition = {
|
||||||
|
condition = "and";
|
||||||
|
conditions =
|
||||||
|
[
|
||||||
|
{ # only start if a keyholder opened the door and if the lounge mpd is currently not playing anything
|
||||||
|
condition = "template";
|
||||||
|
value_template = "{{ state('sensor.keyholder') != 'No Keyholder' }}";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
condition = "state";
|
||||||
|
entity_id = "media_player.lounge";
|
||||||
|
state = "idle";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
action = [
|
||||||
|
{
|
||||||
|
service = "media_player.volume_set";
|
||||||
|
data = {
|
||||||
|
entity_id = "media_player.lounge";
|
||||||
|
volume_level = 1.0;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
service = "media_player.play_media";
|
||||||
|
data = {
|
||||||
|
entity_id = "media_player.lounge";
|
||||||
|
media_content_type = "playlist";
|
||||||
|
media_content_id = "ansage";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{ delay.seconds = 8; }
|
||||||
|
{
|
||||||
|
service = "media_player.volume_set";
|
||||||
|
data = {
|
||||||
|
entity_id = "media_player.lounge";
|
||||||
|
volume_level = 0.6;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
service = "media_player.play_media";
|
||||||
|
data = {
|
||||||
|
entity_id = "media_player.lounge";
|
||||||
|
media_content_type = "playlist";
|
||||||
|
media_content_id = "lassulus superradio";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
]
|
|
@ -93,6 +93,7 @@ in {
|
||||||
light = badair.light;
|
light = badair.light;
|
||||||
media_player = [
|
media_player = [
|
||||||
{ platform = "mpd";
|
{ platform = "mpd";
|
||||||
|
name = "lounge";
|
||||||
host = "lounge.mpd.shack";
|
host = "lounge.mpd.shack";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
@ -117,19 +118,27 @@ in {
|
||||||
#conversation = {};
|
#conversation = {};
|
||||||
history = {};
|
history = {};
|
||||||
logbook = {};
|
logbook = {};
|
||||||
|
logger = {
|
||||||
|
default = "info";
|
||||||
|
};
|
||||||
recorder = {};
|
recorder = {};
|
||||||
tts = [
|
tts = [
|
||||||
{ platform = "google_translate";
|
{ platform = "google_translate";
|
||||||
|
service_name = "say";
|
||||||
language = "de";
|
language = "de";
|
||||||
|
cache = true;
|
||||||
|
time_memory = 57600;
|
||||||
}
|
}
|
||||||
#{ platform = "picotts";
|
#{ platform = "picotts";
|
||||||
# language = "de-DE";
|
# language = "de-DE";
|
||||||
|
# service_name = "say";
|
||||||
#}
|
#}
|
||||||
];
|
];
|
||||||
sun = {};
|
sun = {};
|
||||||
|
|
||||||
automation = wasser.automation
|
automation = wasser.automation
|
||||||
++ badair.automation
|
++ badair.automation
|
||||||
|
++ (import ./automation/shack-startup.nix)
|
||||||
++ (import ./automation/hass-restart.nix);
|
++ (import ./automation/hass-restart.nix);
|
||||||
|
|
||||||
device_tracker = [];
|
device_tracker = [];
|
||||||
|
|
|
@ -2,6 +2,46 @@ let
|
||||||
prefix = "glados";
|
prefix = "glados";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|
||||||
|
say = let
|
||||||
|
# returns a list of actions to be performed on an mpd to say something
|
||||||
|
tts = { message, entity }:
|
||||||
|
[
|
||||||
|
{
|
||||||
|
service = "media_player.turn_on";
|
||||||
|
data.entity_id = "media_player.lounge";
|
||||||
|
}
|
||||||
|
{ service = "media_player.play_media";
|
||||||
|
data = {
|
||||||
|
entity_id = "media_player.lounge";
|
||||||
|
media_content_type = "playlist";
|
||||||
|
media_content_id = "ansage";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
service = "media_player.turn_on";
|
||||||
|
data.entity_id = "media_player.lounge";
|
||||||
|
}
|
||||||
|
{ delay.seconds = 8; }
|
||||||
|
{ service = "tts.say";
|
||||||
|
entity_id = "media_player.lounge";
|
||||||
|
data_template = {
|
||||||
|
inherit message;
|
||||||
|
language = "de";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
in
|
||||||
|
{
|
||||||
|
lounge = message: tts {
|
||||||
|
inherit message;
|
||||||
|
entity = "lounge";
|
||||||
|
};
|
||||||
|
herrenklo = message: tts {
|
||||||
|
inherit message;
|
||||||
|
entity = "herrenklo";
|
||||||
|
};
|
||||||
|
};
|
||||||
esphome =
|
esphome =
|
||||||
{
|
{
|
||||||
temp = {host, topic ? "temperature" }:
|
temp = {host, topic ? "temperature" }:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user