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