diff options
author | makefu <github@syntax-fehler.de> | 2020-04-22 00:36:07 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2020-04-22 00:36:07 +0200 |
commit | 2b33dd262f1cb934b41c23ec9bed47aaa76ba7b8 (patch) | |
tree | 913b945361455ae957335a51ae4d5707e773c2a6 /makefu/2configs/ham/multi | |
parent | 49f06e6d91c34482e495a84b32ec2f961b5db024 (diff) | |
parent | c96504d9a0f8f9f5c80c9630906c177ff3667e55 (diff) |
Merge branch 'master' into 20.03
Diffstat (limited to 'makefu/2configs/ham/multi')
-rw-r--r-- | makefu/2configs/ham/multi/the_playlist.nix | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/makefu/2configs/ham/multi/the_playlist.nix b/makefu/2configs/ham/multi/the_playlist.nix index aa5ce85dc..ad090938c 100644 --- a/makefu/2configs/ham/multi/the_playlist.nix +++ b/makefu/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"; |