ma ham/the_playlist: init

This commit is contained in:
makefu 2020-04-21 21:35:59 +02:00
parent 91d94ddbb7
commit 8fb99675fb
No known key found for this signature in database
GPG key ID: 36F7711F3FC0F225
2 changed files with 60 additions and 0 deletions
makefu/2configs/ham

View file

@ -50,6 +50,8 @@ in {
logger = {
default = "info";
};
rest_command = {}
// the_playlist.rest_command;
tts = [
{ platform = "google_translate";
language = "de";
@ -142,6 +144,7 @@ in {
++ (import ./automation/firetv_restart.nix)
++ kurzzeitwecker.automation
#++ flurlicht.automation
++ the_playlist.automation
++ zigbee.automation;
script =
{ }

View file

@ -1,9 +1,66 @@
# Inputs:
# binary_sensor.playlist_button_good
# binary_sensor.playlist_button_bad
# outputs
# rest_command
# automation
# sensor
{
rest_command = {
good_song = {
url = "http://prism.r:8001/good";
method = "POST";
};
bad_song = {
url = "http://prism.r:8001/skip";
method = "POST";
};
};
automation = [
{
alias = "playlist song publish";
trigger = {
#platform = "event";
#event_data.entity_id = "sensor.the_playlist_song";
platform = "state";
entity_id = "sensor.the_playlist_song";
};
action = {
service = "mqtt.publish";
data = {
topic = "/ham/the_playlist/song";
payload_template = "{{ states.sensor.the_playlist_song.state }}";
};
};
}
{
alias = "playlist upvote on button";
trigger = {
platform = "state";
entity_id = "binary_sensor.playlist_button_good";
from = "off";
to = "on";
};
action.service = "rest_command.good_song";
}
{
alias = "playlist downvote on button";
trigger = {
platform = "state";
entity_id = "binary_sensor.playlist_button_bad";
from = "off";
to = "on";
};
action.service = "rest_command.bad_song";
}
];
sensor = [
{ platform = "rest";
name = "pl";
resource = "http://prism.r:8001/current";
scan_interval = 30;
value_template = "1";
json_attributes = [ "name" "filename" "youtube" ];
}
{ platform = "template";