home_assistant_automation.yaml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. alias: Floppy Player
  2. description: ""
  3. trigger:
  4. - platform: state
  5. entity_id:
  6. - sensor.floppy_player_current_disc_id
  7. id: disc_changed
  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. enabled: true
  19. - platform: state
  20. entity_id:
  21. - sensor.floppy_player_device_status
  22. id: PAUSE
  23. to: PAUSE
  24. enabled: true
  25. - platform: state
  26. entity_id:
  27. - sensor.floppy_player_device_status
  28. id: SKIP
  29. to: SKIP
  30. enabled: true
  31. condition: []
  32. action:
  33. - if:
  34. - condition: trigger
  35. id:
  36. - disc_changed
  37. then:
  38. - service: media_player.play_media
  39. data:
  40. media_content_id: "{{ states('sensor.floppy_player_current_disc_id') | string }}"
  41. media_content_type: "{{ states('sensor.floppy_player_current_disc_type') | string }}"
  42. target:
  43. entity_id: media_player.ytube_music_player
  44. - if:
  45. - condition: trigger
  46. id:
  47. - EJECT
  48. then:
  49. - service: media_player.media_stop
  50. target:
  51. entity_id: media_player.ytube_music_player
  52. data: {}
  53. - if:
  54. - condition: trigger
  55. id:
  56. - PLAY
  57. - PAUSE
  58. then:
  59. - service: media_player.media_play_pause
  60. target:
  61. entity_id:
  62. - media_player.ytube_music_player
  63. data: {}
  64. - if:
  65. - condition: trigger
  66. id:
  67. - SKIP
  68. then:
  69. - service: media_player.media_next_track
  70. target:
  71. entity_id:
  72. - media_player.ytube_music_player
  73. data: {}
  74. mode: single