summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/ham/multi/the_playlist.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2020-11-18 22:23:33 +0100
committermakefu <github@syntax-fehler.de>2020-11-18 22:23:33 +0100
commit78fc347be0a0b680bd39a72ac94418d211f5d777 (patch)
tree9e3b7ccd59bb6b1422f5fdc3422e641bd055ea30 /makefu/2configs/ham/multi/the_playlist.nix
parente04ae7a3147c731fa3eff16721253cec4dfccdbc (diff)
ma ham: use new home-assistant merge function
Diffstat (limited to 'makefu/2configs/ham/multi/the_playlist.nix')
-rw-r--r--makefu/2configs/ham/multi/the_playlist.nix139
1 files changed, 71 insertions, 68 deletions
diff --git a/makefu/2configs/ham/multi/the_playlist.nix b/makefu/2configs/ham/multi/the_playlist.nix
index ad090938c..0d714ea44 100644
--- a/makefu/2configs/ham/multi/the_playlist.nix
+++ b/makefu/2configs/ham/multi/the_playlist.nix
@@ -7,77 +7,80 @@
# 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";
+ services.home-assistant.config =
+ {
+ rest_command = {
+ good_song = {
+ url = "http://prism.r:8001/good";
+ method = "POST";
};
- 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";
+ bad_song = {
+ url = "http://prism.r:8001/skip";
+ method = "POST";
};
- 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";
- sensors = {
- the_playlist_song = {
- friendly_name = "Current Song";
- value_template = ''{{ states.sensor.pl.attributes['name'] }}'';
+ };
+ automation = [
+ {
+ alias = "playlist song publish";
+ trigger = {
+ #platform = "event";
+ #event_data.entity_id = "sensor.the_playlist_song";
+ platform = "state";
+ entity_id = "sensor.the_playlist_song";
};
- the_playlist_url = {
- friendly_name = "Song Youtube URL";
- value_template = ''{{ states.sensor.pl.attributes['youtube'] }}'';
+ action = {
+ service = "mqtt.publish";
+ data = {
+ topic = "/ham/the_playlist/song";
+ payload_template = "{{ states.sensor.the_playlist_song.state }}";
+ };
};
- the_playlist_filename = {
- friendly_name = "Song Filename";
- value_template = ''{{ states.sensor.pl.attributes['filename'] }}'';
+ }
+ {
+ 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";
+ sensors = {
+ the_playlist_song = {
+ friendly_name = "Current Song";
+ value_template = ''{{ states.sensor.pl.attributes['name'] }}'';
+ };
+ the_playlist_url = {
+ friendly_name = "Song Youtube URL";
+ value_template = ''{{ states.sensor.pl.attributes['youtube'] }}'';
+ };
+ the_playlist_filename = {
+ friendly_name = "Song Filename";
+ value_template = ''{{ states.sensor.pl.attributes['filename'] }}'';
+ };
+ };
+ }
+ ];
+ };
}