This weekend, my father turned 50. Due to COVID-19, celebrating this milestone was not possible in the traditional way. Instead, we invited people to come during certain timeslots over the course of a weekend. An unforgettable experience in it's own way, although sadly we could not invite everyone.

Because of this, we asked our friends and family to send in video messages congratulating my father. Many people send in creative clips which I wanted to present in a special way. That's why I created a magical but simple button using Home Assistant and a Xiaomi Zigbee button.

The set-up

It is a real simple setup. Via Zigbee2MQTT, I connected a Xiaomi Aqara Wireless Mini Switch to Home Assistant. Next up, I placed all the video files of our friends and family in the '/www' folder of my Home Assistant installation. The last thing required is a screen to cast the videos to. In our case, it was our living room television with a Chromecast built in.

A little automation

All that's left to do, is to write a simple automation and script that sends a random video from the selection to the television, when the button is pressed.

- id: dad_birthday_button
  alias: "When dad presses the button"
  trigger:
    - platform: state
      entity_id: sensor.button_click
      to: single
  condition: []
  action:
    - service: script.turn_on
      entity_id: script.dad_birthday_video
Automation to kick of the script when the button is pressed.
dad_birthday_video:
  alias: "Play a video for dad's birthday"
  sequence:
  - service: media_player.play_media
    data_template:
      entity_id: media_player.livingroom_tv
      media_content_id: " {{ ['/local/path/to/video1.mp4', '/local/path/to/video2.mp4', '/local/path/to/video3', '/local/path/to/video4.mp4', '/local/path/to/video5.mp4'] | random }} "
      media_content_type: video
Script to play a random video. Add as many videos as you have to the code.

As you can see, it is a simple solution, but with a magical effect. With every button press, another surprise!