[SOLVED] Fire TV Automation to start specific app at specific time

Hello! I recently had my RPi take a dive so i had to setup a new one and I found the Tinkerboard has a HASSIo image now (yay!) so for the first time i am trying HASSIO and Tinkerboard for HA. I used my Dropbox backup of the config folder to get everything up and running. It all seems great but when I tried adding a new automation to the system I am getting an error in the log file when it fires. The goal of the automation is to have my Amazon Fire TV load the local news channels app then scroll right one then select the play news option to have the local live news feed streaming when I wake up.
I setup the HASSIO ADB bridge, updated the configuration.yaml with the details for the Fire TV and successfully got the key as well as checked the box to always allow the Tinkerboard/HASSIO without issues.

configuration.yaml

media_player:
  - platform: androidtv
    name: Joes_Fire_TV
    device_class: firetv
    host: 10.201.69.187
    adb_server_ip: 127.0.0.1
    apps:
      "com.hubbard.KSTP": "KSTP News"
      "com.sling": "Sling TV"
      "com.netflix.ninja": "Netflix"

automations.yaml

- alias: 6:45am - Turn on KSTP 45 News
  id: 6:45am_Turn_on_KSTP_45_New
  trigger:
    - platform: time
      at: 06:45
  condition:
    condition: time
    weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
  action:
    - service: androidtv.adb_command
      data:
        entity_id: media_player.Joes_Fire_TV
        command: "HOME"
    - service: media_player.select_source
      data:
        entity_id: media_player.Joes_Fire_TV
        source: 'com.hubbard.KSTP'
    - service: androidtv.adb_command
      data:
        entity_id: media_player.Joes_Fire_TV
        command: "RIGHT"
    - service: androidtv.adb_command
      data:
        entity_id: media_player.Joes_Fire_TV
        command: "CENTER"

Error in the log file:

ERROR (MainThread) [homeassistant.components.automation] Error while executing automation automation.6_45am_turn_on_kstp_45_news. Invalid data for call_service at pos 1: extra keys not allowed @ data[‘source’]

I read through the documentation and have been wracking my brain over this for about two days. I am not a programmer but I can hack some basic Python if needed. Its probably something minor I am missing but please point me in the right direction.

Thank you!

1 Like

My guess is that the entity_id should be all lowercase. name and entity_id are not the same – name is what appears in the UI, whereas entity_id is Home Assistant’s unique ID for the component.

Also, some suggestions:

  1. Remove the colon from the automation’s ID.
  2. Put quotes around anything in your configuration that contains special characters or might be misinterpreted, such as the automation’s alias and '06:45'.
  3. You don’t need to add Netflix to the apps in your configuration, the backend library already recognizes it.
1 Like

Hi JeffLIrion
Thanks for the tips. I updated my config with them. Found some minor issues when I tried upgrading from 0.94.4 to 0.95.4 so that delayed me in responding. I have now been able to test all the changes and am still not able to communicate with the Fire TV. At least now there are no errors in my logs when I trigger the automation so that is a win. I am seeing no response from the Fire TV itself or in my Lovelace front end. I was getting an error about the sqlite3 database being locked but when I disable all other HASS.IO add-ons that issue went away. I also was having errors with the ADB add-on not being able to use its port and had to change it a few times. Only time will tel if with all add-ons disabled that is resolved.

Anyways… I am now at a point where the ADB add-on is acting like nothing wrong is happening but not showing anything in the logs to show anything right is happening either.

current automation.yaml

########################################
# turn on Fire TV to KSTP
########################################
- alias: "6:45am - Turn on KSTP 45 News"
  id: 645am_Turn_on_KSTP_45_New
  trigger:
    - platform: time
      at: 06:45
  condition:
    condition: time
    weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
  action:
    - service: androidtv.adb_command
      data:
        entity_id: media_player.Joes_Fire_TV
        command: "HOME"
    - service: media_player.select_source
      data:
        entity_id: media_player.Joes_Fire_TV
        source: 'com.hubbard.KSTP'
    - service: androidtv.adb_command
      data:
        entity_id: media_player.Joes_Fire_TV
        command: 'com.hubbard.KSTP'
    - service: androidtv.adb_command
      data:
        entity_id: media_player.Joes_Fire_TV
        command: "RIGHT"
    - service: androidtv.adb_command
      data:
        entity_id: media_player.Joes_Fire_TV
        command: "CENTER"

current configuration.yaml

media_player:
  - platform: androidtv
    name: Joes_Fire_TV
    device_class: firetv
    host: 10.201.69.187
    adb_server_ip: 127.0.0.1
    adb_server_port: 10245
    # get_sources: false
    apps:
      "com.hubbard.KSTP": "KSTP News"
      "com.sling": "Sling TV"
      "com.netflix.ninja": "Netflix"

and the bit that changed before getting the player to show up in Lovelace
customize.yaml

device_tracker.amazon_89817f494_hsd1_mn_comcast_net:
  friendly_name: Joes_Fire_TV

Change media_player.Joes_Fire_TV to media_player.joes_fire_tv.

Hi,
So i figured it out… sorta. If I change the source line from “com.hubbard.KSTP” to “com.netflix.ninja” it will work completely including the navigation buttons after the app loads. I found the source list in the Lovelace interface allows me to get both Netflix and Sling TV to load so I changed the automation script. But even from Lovelace when selecting the com.hubbard.KSTP source nothing happens. Also Pluto TV is not listed nor SiriusXM, The CW or NBC Sports. Those are all apps installed on the Fire TV and working perfectly fine using the remote to navigate to them. The just don’t show up in the source list.

Thank you for your help getting the automation working. I will continue with posting on the developer forum to get assistance with the new problem.

I am having a similiar issue with the FuboTV app (source: com.fubo.firetv.screen). I cannot launch it from HA via source select or a script. I assume this could be because it is does not show up in the source list. When I launch the app via FireTV the source shows correctly in HA. Any ideas no why this is the case?

1 Like