home_assistant_automation.yaml 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. alias: Floppy Player
  2. description: ""
  3. trigger:
  4. - platform: state
  5. entity_id:
  6. - sensor.floppy_player_current_disc
  7. id: play song
  8. - platform: state
  9. entity_id:
  10. - sensor.floppy_player_device_status
  11. id: EJECT
  12. to: EJECT
  13. - platform: state
  14. entity_id:
  15. - sensor.floppy_player_device_status
  16. id: PLAY
  17. to: PLAY
  18. - platform: state
  19. entity_id:
  20. - sensor.floppy_player_device_status
  21. id: PAUSE
  22. to: PAUSE
  23. condition: []
  24. action:
  25. - if:
  26. - condition: trigger
  27. id:
  28. - play song
  29. then:
  30. - service: media_player.play_media
  31. data:
  32. media_content_id: "{{ states('sensor.floppy_player_current_disc_id') }}"
  33. media_content_type: "{{ states('sensor.floppy_player_current_disc_type') }}"
  34. target:
  35. entity_id: media_player.ytube_music_player
  36. - if:
  37. - condition: trigger
  38. id:
  39. - EJECT
  40. then:
  41. - service: media_player.media_stop
  42. target:
  43. entity_id: media_player.ytube_music_player
  44. data: {}
  45. - if:
  46. - condition: trigger
  47. id:
  48. - PLAY
  49. - PAUSE
  50. then:
  51. - service: media_player.media_play_pause
  52. target:
  53. entity_id:
  54. - media_player.ytube_music_player
  55. data: {}
  56. mode: single