Post

Home Assistant Podcast Appearance

It’s been a minute since I’ve updated my site. I figure it’s a great time to add in some things I’ve been up to.

Back in September 2023 Phil and Rohan from the Home Assistant Podcast had me on as a guest for episode 118. This started off with a competition to send in your coolest automation for the Home Assistant Podcast birthday. I sent in mine and got runner up! It was great to be on the podcast, and wonderful to meet Phil and Rohan.

The Submission

The submission revolved around automatically displaying a Unifi camera I have mounted in my twins room. When nap time starts I wanted to have that RTSP stream show up on on the TV downstairs in the living room. This has gone through some iterations since my discussion on the podcast. But the latest iteration looks like so:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
- alias: Show Nursery Camera on TV automatically
  id: nursery_show_camera_automatically
  trigger:
    - platform: state
      entity_id: input_boolean.nap_mode
      to: "on"
  condition:
    not:
      - condition: state
        entity_id: media_player.apple_tv_living_room
        state: "playing"
  action:
    - service: homeassistant.turn_on
      entity_id: remote.apple_tv_living_room
    - service: remote.send_command
      target:
        entity_id: remote.apple_tv_living_room
      data:
        command: "wakeup"
    - delay:
        seconds: 30
    - event: homekit_faux_camera_event
    - delay:
        seconds: 5
    - service: remote.send_command
      target:
        entity_id: remote.apple_tv_living_room
      data:
        command: "home"

This fakes an input into HomeKit to display a linked camera1 This forces the camera feed to pop up on the AppleTV display, and with some some brittle (but fingers cross Apple doesn’t break this on me) timing events to use the AppleTV Remote input to force it to go full screen.

Previous Version

Before I picked up an AppleTV an old MiBox S was running the show. It would used the Android debugger tool adb to send the commands. This would power on the system, set the set the RTSP stream directly. More direct and straightforward than the AppleTVs timing method. Hopefully Apple will allow a direct RTSP stream one day for less brittle timing in the future. It looked like so:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
- alias: Toggle TV Monitor
  trigger:
    platform: state
    entity_id: input_boolean.nap_mode
  condition:
    - condition: time
      after: "08:00:00"
  action:
    - wait_template: "{{ not is_state('media_player.living_room_mi_box_s', 'unavailable') }}"
      continue_on_timeout: false
      timeout: "00:20:00"
    - choose:
        # Turning nap on
        - conditions:
            - condition: state
              entity_id: input_boolean.nap_mode
              state: "on"
          sequence:
            - choose:
                - conditions:
                    - condition: state
                      entity_id: media_player.living_room_mi_box_s
                      state: "off"
                  sequence:
                    - service: androidtv.adb_command
                      data:
                        entity_id: media_player.living_room_mi_box_s
                        command: "POWER"
                    - service: androidtv.adb_command
                      data:
                        entity_id: media_player.living_room_mi_box_s
                        command: !secret baby_cam_adb_command
                    - service: androidtv.adb_command
                      data:
                        entity_id: media_player.living_room_mi_box_s
                        command: "adb shell media volume --set 0"
              default:
                - service: androidtv.adb_command
                  data:
                    entity_id: media_player.living_room_mi_box_s
                    command: !secret baby_cam_adb_command
        # Turning nap off
        - conditions:
            - condition: state
              entity_id: input_boolean.nap_mode
              state: "off"
          sequence:
            - wait_template: "{{ not is_state('media_player.living_room_mi_box_s', 'unavailable') }}"
              continue_on_timeout: false
              timeout: "00:20:00"
            - choose:
                - conditions:
                    - condition: template
                      value_template: "{{ not is_state('media_player.living_room_mi_box_s', 'off') }}"
                  sequence:
                    - service: androidtv.adb_command
                      data:
                        entity_id: media_player.living_room_mi_box_s
                        command: "HOME"
                    - service: androidtv.adb_command
                      data:
                        entity_id: media_player.living_room_mi_box_s
                        command: "POWER"

Video

Here’s the YouTube version of the podcast.

This post is licensed under CC BY 4.0 by the author.