Turn On TV using Homekit and Hassbian

Hi

I have read a lot of post on here and people say they are noobs, but I really am a noob, and have very little understanding of configuration language and processes.

I’m very new to the home automation sphere and my end goal is to use HomeKit to control all my devices. I have Hassbian installed on a Pi B3+.

I have some very basic scripts installed, but I can seem to be able to turn my Panasonic TV on and off using HomeKit.

This is what I have in my config.yaml file:

switch:

  • platform: template
    switches:
    tv:
    friendly_name: “Lounge TV”
    icon_template: mdi:television
    value_template: “{{ states.media_player.stuandbarnstv.state != ‘off’ }}”
    turn_on:
    service: media_player.turn_on
    data:
    entity_id: media_player.stuandbarnstv
    turn_off:
    service: media_player.turn_off
    data:
    entity_id: media_player.stuandbarnstv

I can see a switch on my HA dashboard, and I can see a switch in my HomeKit app, but neither of them do anything. In HA the switch is on by default, and when I toggle it off it goes off for a few seconds and then back on, but nothing happens to the TV. In the HomeKit app, I can toggle it off and on, but again, nothing happens.

I sure there is a simple solution (hoping so) but I fear my inexperience is letting me down.

Any suggestions?

Ta
Barns

I’m assuming you can control the tv media player from the HA interface.

I’m not sure but you might then be able to directly configure the media player in HomeKit.

you found any way to do this?

You can just do this, as mentioned above, with the Homekit config: You need to specify per media player which features you want brought in Homekit and it will create the switches.

Per Homekit page instructions:

# Example configuration.yaml entry configuring HomeKit
homekit:
  filter:
    include_domains:
      - alarm_control_panel
      - light
      - media_player
  entity_config:
    alarm_control_panel.home:
      code: 1234
    light.kitchen_table:
      name: Kitchen Table Light
    lock.front_door:
      code: 1234
    media_player.living_room:
      feature_list:
        - feature: on_off
        - feature: play_pause
        - feature: play_stop
        - feature: toggle_mute
    switch.bedroom_outlet:
      type: outlet
1 Like