summaryrefslogtreecommitdiffstats
path: root/2configs/ham/multi
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2020-04-21 21:35:59 +0200
committermakefu <github@syntax-fehler.de>2020-04-21 21:35:59 +0200
commit6f0ccd445eb89e5e16ed31601d6cf60d968f9166 (patch)
tree85a6202f1b4900ff03ed604ba2c6e45f01a5bd73 /2configs/ham/multi
parent037b9f5699cfcbc5e3b02de3cc2c02a877aee0f9 (diff)
ma ham/the_playlist: init
Diffstat (limited to '2configs/ham/multi')
-rw-r--r--2configs/ham/multi/the_playlist.nix57
1 files changed, 57 insertions, 0 deletions
diff --git a/2configs/ham/multi/the_playlist.nix b/2configs/ham/multi/the_playlist.nix
index aa5ce85dc..ad090938c 100644
--- a/2configs/ham/multi/the_playlist.nix
+++ b/2configs/ham/multi/the_playlist.nix
@@ -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";