From 6d6d07929efe987c285181cbd266248a7c60c85d Mon Sep 17 00:00:00 2001 From: Karl Hudgell Date: Fri, 20 Sep 2024 14:13:04 +0100 Subject: [PATCH] home assistant automation yaml --- home_assistant_automation.yaml | 56 ++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 home_assistant_automation.yaml diff --git a/home_assistant_automation.yaml b/home_assistant_automation.yaml new file mode 100644 index 0000000..ef9c48a --- /dev/null +++ b/home_assistant_automation.yaml @@ -0,0 +1,56 @@ +alias: Floppy Player +description: "" +trigger: + - platform: state + entity_id: + - sensor.floppy_player_current_disc + id: play song + - platform: state + entity_id: + - sensor.floppy_player_device_status + id: EJECT + to: EJECT + - platform: state + entity_id: + - sensor.floppy_player_device_status + id: PLAY + to: PLAY + - platform: state + entity_id: + - sensor.floppy_player_device_status + id: PAUSE + to: PAUSE +condition: [] +action: + - if: + - condition: trigger + id: + - play song + then: + - service: media_player.play_media + data: + media_content_id: "{{ states('sensor.floppy_player_current_disc_id') }}" + media_content_type: "{{ states('sensor.floppy_player_current_disc_type') }}" + target: + entity_id: media_player.ytube_music_player + - if: + - condition: trigger + id: + - EJECT + then: + - service: media_player.media_stop + target: + entity_id: media_player.ytube_music_player + data: {} + - if: + - condition: trigger + id: + - PLAY + - PAUSE + then: + - service: media_player.media_play_pause + target: + entity_id: + - media_player.ytube_music_player + data: {} +mode: single