Coder Social home page Coder Social logo

marrobhd / firetv-card Goto Github PK

View Code? Open in Web Editor NEW
29.0 3.0 4.0 447 KB

๐Ÿ“บ FireTV Remote Card

License: Apache License 2.0

JavaScript 100.00%
home-assistant lovelace-ui lovelace lovelace-card hassio custom-cards home-assistant-frontend home-assistant-custom lovelace-firetv firetv-card

firetv-card's Introduction

โš ๏ธ Archived: Please move to https://github.com/marrobHD/tv-card

FireTV Remote Card

๐Ÿ“บ FireTV Lovelace Card editited by mar_robHD

GitHub Release License

Project Maintenance GitHub Activity hacs_badge Discord Community Forum

Github

Support

This card is for Lovelace on Home Assistant that display a FireTV remote.

NOTE: Firefox releases before 67 are not supported

https://twitter.com/_developit/status/1090364879377260544

ex

Options

Name Type Requirement Description
type string Required custom:firetv-card
entity string Required random entity
remote string Optional remote entity of Roku device. Default assume named like entity
name string Optional Card name
theme string Optional Card theme
tv boolean Optional If true shows volume and power buttons. Default false
power service Optional service to call when power button pressed
back service Optional service to call when back button pressed
home service Optional service to call when home button pressed
menu service Optional service to call when menu button pressed
up service Optional service to call when up button pressed
left service Optional service to call when left button pressed
select service Optional service to call when select button pressed
right service Optional service to call when right button pressed
down service Optional service to call when down button pressed
reverse service Optional service to call when reverse button pressed
pauseplay service Optional service to call when play/pause button pressed
forward service Optional service to call when forward button pressed
volume_up service Optional service to call when volume up button pressed
volume_down service Optional service to call when volume down button pressed
volume_mute service Optional service to call when volume mute button pressed
invisible service Optional service to call when invisible button between the power buttons is pressed

service Options

Name Type Requirement Description
service string Required Service to call
service_data string Optional Service data to use

Installation

HACS:

Add this to your HACS settings tab:

https://github.com/marrobHD/firetv-card

example

Step 1

Install firetv-card by copying firetv-card.js and firetv-card-editor.js from this repo to <config directory>/www/firetv-card.js on your Home Assistant instance.

Example:

wget https://raw.githubusercontent.com/marrobHD/firetv-card/master/firetv-card.js
wget https://raw.githubusercontent.com/marrobHD/firetv-card/master/firetv-card-editor.js
mv firetv-card* /config/www/

Step 2

Link firetv-card inside your ui-lovelace.yaml.

resources:
  - type: module
    url: /local/tv-card.js?v=1

Step 3

Add a custom element in your ui-lovelace.yaml

        type: 'custom:firetv-card'
        theme: Backend-selected
        tv: false
        entity: sun.sun
        name: FireTV
        power:
          service: androidtv.adb_command
          service_data:
            command: "input keyevent 26"
            entity_id: media_player.firetv
        back:
          service: androidtv.adb_command
          service_data:
            command: BACK
            entity_id: media_player.firetv
        home:
          service: androidtv.adb_command
          service_data:
            command: HOME
            entity_id: media_player.firetv
        down:
          service: androidtv.adb_command
          service_data:
            command: DOWN
            entity_id: media_player.firetv
        up:
          service: androidtv.adb_command
          service_data:
            command: UP
            entity_id: media_player.firetv
        left:
          service: androidtv.adb_command
          service_data:
            command: LEFT
            entity_id: media_player.firetv
        select:
          service: androidtv.adb_command
          service_data:
            command: "input keyevent 23"
            entity_id: media_player.firetv
        right:
          service: androidtv.adb_command
          service_data:
            command: RIGHT
            entity_id: media_player.firetv
        reverse:
          service: androidtv.adb_command
          service_data:
            command: input keyevent 89
            entity_id: media_player.firetv
        pauseplay:
          service: androidtv.adb_command
          service_data:
            command: input keyevent 85
            entity_id: media_player.firetv
        forward:
          service: androidtv.adb_command
          service_data:
            command: input keyevent 90
            entity_id: media_player.firetv
        menu:
          service: androidtv.adb_command
          service_data:
            command: MENU
            entity_id: media_player.firetv

Example 1:

You can use the card in combination with the browser mod integration. That means that you can create a ex. input_boolean which opens when you click on its icon:

type: entities
entities:
  - entity: input_boolean.firetv
    name: FireTV
    tap_action:
      action: fire-dom-event
      browser_mod:
        command: popup
        style:
          border-radius: 20px
          '--ha-card-border-radius': 0px
        title: FireTV Fernbedienung
        card:
          type: 'custom:firetv-card'
          entity: sun.sun
          back:
            service: androidtv.adb_command
            service_data:
              command: BACK
              entity_id: media_player.firetv
          down:
            service: androidtv.adb_command
            service_data:
              command: DOWN
              entity_id: media_player.firetv
          forward:
            service: androidtv.adb_command
            service_data:
              command: input keyevent 90
              entity_id: media_player.firetv
          home:
            service: androidtv.adb_command
            service_data:
              command: HOME
              entity_id: media_player.firetv
          left:
            service: androidtv.adb_command
            service_data:
              command: LEFT
              entity_id: media_player.firetv
          menu:
            service: androidtv.adb_command
            service_data:
              command: MENU
              entity_id: media_player.firetv
          pauseplay:
            service: androidtv.adb_command
            service_data:
              command: input keyevent 85
              entity_id: media_player.firetv
          power:
            service: androidtv.adb_command
            service_data:
              command: input keyevent 26
              entity_id: media_player.firetv
          reverse:
            service: androidtv.adb_command
            service_data:
              command: input keyevent 89
              entity_id: media_player.firetv
          right:
            service: androidtv.adb_command
            service_data:
              command: RIGHT
              entity_id: media_player.firetv
          select:
            service: androidtv.adb_command
            service_data:
              command: input keyevent 23
              entity_id: media_player.firetv
          tv: false
          up:
            service: androidtv.adb_command
            service_data:
              command: UP
              entity_id: media_player.firetv

suspended:Custom Updater:

Add this to your configuration.yaml

custom_updater:
  card_urls:
    - https://raw.githubusercontent.com/marrobHD/firetv-card/master/tracker.json

Troubleshooting

firetv-card's People

Contributors

arniebarni avatar iantrich avatar villhellm avatar wojtek14a avatar wrt54g avatar xorbital avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

firetv-card's Issues

All icons missing

Checklist:

  • I updated to the latest version available
  • I cleared the cache of my browser

Release with the issue: 0.110.0

Last working release (if known): 0.109.6

Browser and Operating System: Windows 10, Chrome 81

Description of problem:

After upgrading to latest version all icons are missing (both in editor and lovelace card). Probably has to do with a new way of dealing with icons described in the release notes.

image

Javascript errors shown in the web inspector (if applicable):


Additional information:

Volume Keys Without Power Buttons

Is your feature request related to a problem? Please describe.
Is it possible to have the volume buttons controlled by your card without having the TV power buttons. I use scripts to turn on the TV and set the source. I have attached a sample from my configuration

D650FB2C-1067-4DBB-9C9E-7182553A6F80

Describe the solution you'd like
Have options for TV Power and TV Volume instead of the current TV

Describe alternatives you've considered
Currently have have a your card in a vertical stack card. I have the volume controls as a grid card in the bottom layer.

Additional context
Add any other context or screenshots about the feature request here.

Keycodes for Volume up/down/mute

Could you also provide the keycodes for volume up/down/mute?

Also the power keys are not working somehow for me?
Play/Pause/Right/Left/movement does work though?
Copied the readme configuration..

2020-07-09 23:59:44 ERROR (MainThread) [frontend.js.latest.202007020] https://test123.org:8124/hacsfiles/firetv-card/firetv-card.js:272:11 Uncaught TypeError: Cannot read property 'service' of undefined

tv: false not hiding power buttons

Checklist:

  • I updated to the latest version available
  • I cleared the cache of my browser

Release with the issue:
v0.1.1

Last working release (if known):
unknown
Browser and Operating System:

  • Google Chrome, 81.0.4044.138 (Official) (64-bit)

  • Windows 10 10.0.18363

Description of problem:

In the README section you specify that after setting tv parameter to false both volume and power buttons will be hidden. From my observations I can tell that only volume buttons are hidden, power ones remain as there were with tv set to true.

image

Javascript errors shown in the web inspector (if applicable):


Additional information:
I would like to hide power buttons as well, either with tv: false or another dedicated config variable.

Did not work with FireTV Cube - workaround provided

Checklist:

  • I updated to the latest version available
  • I cleared the cache of my browser

Release with the issue:
Latest
Last working release (if known):
NA
Browser and Operating System:
NA

Description of problem:
The buttons do not do anything with FireTV cube.

I expect that when I push the mute button, it mutes, but it does not.

Javascript errors shown in the web inspector (if applicable):
NA


Additional information:

Re-mapping the buttons after figuring out which each is through androidtv.learn_sendevent has gotten me to the following workaround. I'm not sure if this is unique to my FireTV or all...

To get the commands for call service, I used developer tools pane to call androidtv.learn_sendevent and press the button a bunch of times... then in developer tools looked at the attibutes of my media player for the adb_response attribute as documented in the androidtv git repo

Thanks for the awesome card and I hope the information provided is helpful for the next person in my shoes.

type: custom:firetv-card
theme: Backend-selected
tv: false
entity: media_player.fire_tv_192_168_2_27
name: FireTV Cube
select:
  service: androidtv.adb_command
  service_data:
    command: >-
      sendevent /dev/input/event5 4 4 458840 && sendevent /dev/input/event5 1 96
      1 && sendevent /dev/input/event5 0 0 0 && sendevent /dev/input/event5 4 4
      458840 && sendevent /dev/input/event5 1 96 0 && sendevent
      /dev/input/event5 0 0 0
    entity_id: media_player.fire_tv_192_168_2_27
up:
  service: androidtv.adb_command
  service_data:
    command: >-
      sendevent /dev/input/event5 4 4 458834 && sendevent /dev/input/event5 1
      103 1 && sendevent /dev/input/event5 0 0 0 && sendevent /dev/input/event5
      4 4 458834 && sendevent /dev/input/event5 1 103 0 && sendevent
      /dev/input/event5 0 0 0
    entity_id: media_player.fire_tv_192_168_2_27
down:
  service: androidtv.adb_command
  service_data:
    command: >-
      sendevent /dev/input/event5 4 4 458833 && sendevent /dev/input/event5 1
      108 1 && sendevent /dev/input/event5 0 0 0 && sendevent /dev/input/event5
      4 4 458833 && sendevent /dev/input/event5 1 108 0 && sendevent
      /dev/input/event5 0 0 0
    entity_id: media_player.fire_tv_192_168_2_27
right:
  service: androidtv.adb_command
  service_data:
    command: >-
      sendevent /dev/input/event5 4 4 458831 && sendevent /dev/input/event5 1
      106 1 && sendevent /dev/input/event5 0 0 0 && sendevent /dev/input/event5
      4 4 458831 && sendevent /dev/input/event5 1 106 0 && sendevent
      /dev/input/event5 0 0 0
    entity_id: media_player.fire_tv_192_168_2_27
left:
  service: androidtv.adb_command
  service_data:
    command: >-
      sendevent /dev/input/event5 4 4 458832 && sendevent /dev/input/event5 1
      105 1 && sendevent /dev/input/event5 0 0 0 && sendevent /dev/input/event5
      4 4 458832 && sendevent /dev/input/event5 1 105 0 && sendevent
      /dev/input/event5 0 0 0
    entity_id: media_player.fire_tv_192_168_2_27
volume_mute:
  service: androidtv.adb_command
  service_data:
    command: >-
      sendevent /dev/input/event5 4 4 786658 && sendevent /dev/input/event5 1
      113 1 && sendevent /dev/input/event5 0 0 0 && sendevent /dev/input/event5
      4 4 786658 && sendevent /dev/input/event5 1 113 0 && sendevent
      /dev/input/event5 0 0 0
    entity_id: media_player.fire_tv_192_168_2_27
volume_up:
  service: androidtv.adb_command
  service_data:
    command: >-
      sendevent /dev/input/event5 4 4 786665 && sendevent /dev/input/event5 1
      115 1 && sendevent /dev/input/event5 0 0 0 && sendevent /dev/input/event5
      4 4 786665 && sendevent /dev/input/event5 1 115 0 && sendevent
      /dev/input/event5 0 0 0
    entity_id: media_player.fire_tv_192_168_2_27
back:
  service: androidtv.adb_command
  service_data:
    command: >-
      sendevent /dev/input/event5 4 4 458993 && sendevent /dev/input/event5 1
      158 1 && sendevent /dev/input/event5 0 0 0 && sendevent /dev/input/event5
      4 4 458993 && sendevent /dev/input/event5 1 158 0 && sendevent
      /dev/input/event5 0 0 0
    entity_id: media_player.fire_tv_192_168_2_27
volume_down:
  service: androidtv.adb_command
  service_data:
    command: >-
      sendevent /dev/input/event5 4 4 786666 && sendevent /dev/input/event5 1
      114 1 && sendevent /dev/input/event5 0 0 0 && sendevent /dev/input/event5
      4 4 786666 && sendevent /dev/input/event5 1 114 0 && sendevent
      /dev/input/event5 0 0 0 && sendevent /dev/input/event5 4 4 786666 &&
      sendevent /dev/input/event5 1 114 1 && sendevent /dev/input/event5 0 0 0
      && sendevent /dev/input/event5 4 4 786666 && sendevent /dev/input/event5 1
      114 0 && sendevent /dev/input/event5 0 0 0
    entity_id: media_player.fire_tv_192_168_2_27
menu:
  service: androidtv.adb_command
  service_data:
    command: >-
      sendevent /dev/input/event5 4 4 786496 && sendevent /dev/input/event5 1
      139 1 && sendevent /dev/input/event5 0 0 0 && sendevent /dev/input/event5
      4 4 786496 && sendevent /dev/input/event5 1 139 0 && sendevent
      /dev/input/event5 0 0 0
    entity_id: media_player.fire_tv_192_168_2_27
reverse:
  service: androidtv.adb_command
  service_data:
    command: >-
      sendevent /dev/input/event5 4 4 786612 && sendevent /dev/input/event5 1
      168 1 && sendevent /dev/input/event5 0 0 0 && sendevent /dev/input/event5
      4 4 786612  && sendevent /dev/input/event5 1 168 0 && sendevent
      /dev/input/event5 0 0 0
    entity_id: media_player.fire_tv_192_168_2_27
forward:
  service: androidtv.adb_command
  service_data:
    command: >-
      sendevent /dev/input/event5 4 4 786611 && sendevent /dev/input/event5 1
      208 1 && sendevent /dev/input/event5 0 0 0 && sendevent /dev/input/event5
      4 4 786611 && sendevent /dev/input/event5 1 208 0 && sendevent
      /dev/input/event5 0 0 0
    entity_id: media_player.fire_tv_192_168_2_27
pauseplay:
  service: androidtv.adb_command
  service_data:
    command: >-
      sendevent /dev/input/event5 4 4 786637 && sendevent /dev/input/event5 1
      164 1 && sendevent /dev/input/event5 0 0 0 && sendevent /dev/input/event5
      4 4 786637 && sendevent /dev/input/event5 1 164 0 && sendevent
      /dev/input/event5 0 0 0
    entity_id: media_player.fire_tv_192_168_2_27
home:
  service: androidtv.adb_command
  service_data:
    command: >-
      sendevent /dev/input/event5 4 4 786979 && sendevent /dev/input/event5 1
      172 1  && sendevent /dev/input/event5 0 0 0 && sendevent /dev/input/event5
      4 4 786979 && sendevent /dev/input/event5 1 172 0 && sendevent
      /dev/input/event5 0 0 0
    entity_id: media_player.fire_tv_192_168_2_27

Icons are gone with 2021.11

Checklist:

  • I updated to the latest version available
  • I cleared the cache of my browser

Release with the issue:
2021.11

Last working release (if known):
2021.10

Browser and Operating System:

iOS app of Homeassistant

Description of problem:

All icons of my Lovelace card are gone.

Javascript errors shown in the web inspector (if applicable):


Additional information:

Certain Media Player services not found

I love where this is heading. I implemented this on my firetv with a sony bravia tv. Most things work but cannot get the following to work.

Commands not working.

  • media_player.volume_up
  • media_player.volume_down
  • media_player.volume_mute
  • media_player.media_play_pause

All the commands give the same error.
Failed to call service remote/send_command. Service not found.

All commands work using the services tab in the Developer section.

Here is my configuration. If you could take a look that would be great. I am on 0.107.1 release of HA. I even removed sun.sun as the entity and added the sony tv entity. Same effect.

type: 'custom:firetv-card'
entity: sun.sun
name: Family Room TV
tv: true
power:
service: media_player.toggle
service_data:
entity_id: media_player.family_room_tv
left:
service: androidtv.adb_command
service_data:
command: LEFT
entity_id: media_player.family_room_fire_tv
up:
service: androidtv.adb_command
service_data:
command: UP
entity_id: media_player.family_room_fire_tv
right:
service: androidtv.adb_command
service_data:
command: RIGHT
entity_id: media_player.family_room_fire_tv
down:
service: androidtv.adb_command
service_data:
command: DOWN
entity_id: media_player.family_room_fire_tv
select:
service: androidtv.adb_command
service_data:
command: ENTER
entity_id: media_player.family_room_fire_tv
back:
service: androidtv.adb_command
service_data:
command: BACK
entity_id: media_player.family_room_fire_tv
home:
service: androidtv.adb_command
service_data:
command: HOME
entity_id: media_player.family_room_fire_tv
menu:
service: androidtv.adb_command
service_data:
command: MENU
entity_id: media_player.family_room_fire_tv
volume_up:
service: media_player.volume_up
service_data:
entity_id: media_player.family_room_tv
volume_down:
service: media_player.volume_down
service_data:
entity_id: media_player.family_room_tv
volume_mute:
service: media_player.volume_mute
service_data:
entity_id: media_player.family_room_tv
is_volume_muted: true
play:
service: media_player.media_play_pause
service_data:
entity_id: media_player.family_room_fire_tv
reverse:
service: media_player.media_previous_track
service_data:
entity_id: media_player.family_room_fire_tv
forward:
service: media_player.media_next_track
service_data:
entity_id: media_player.family_room_fire_tv

๐Ÿšจ I'm looking for maintainer(s)!

As many of you probably have noticed, this project hasn't been very active in the last years.

I currently do not have enough time to work on it and therefore I'm looking for one or more people that would be interested in maintaining / developing on this and the other FireTV-Card project.
Some steps were for example to migrate to typescript.

Contact me if you are interested.

Thanks to all users & contributors!

I don't see nothings

hi,
I installed from hacs, I don't see any errors in the logs but I don't see the graphic structure of the card and not even the services to be configured.
where am I wrong?
b&r and tnx
i wrote in my ui:

  • url: /hacsfiles/firetv-card/firetv-card.js
  • url: /local/tv-card.js?v=1
  • url: /local/tv-card.js
  • url: /community_plugin/firetv-card/firetv-card.js
    i tested all, in the card (ui) i wrote
    cards:
    • type: 'custom:firetv-card'
      theme: Backend-selected
      tv: false
      name: FireTV
      power:
      service: androidtv.adb_command
      service_data:
      command: "input keyevent 26"
      entity_id: media_player.name-my-firestick

2 power buttons?

Why are there 2 power buttons? Can I control 2 devices with this card? IE Sound bar and TV?

Also, could you allow separate services for turn_on and turn_off like how universal media players do it?

commands:
  turn_on:
    service: switch.turn_on
    data:
      entity_id: switch.living_room_tv_power
  turn_off:
    service: switch.turn_off
    data:
      entity_id: switch.living_room_tv_power

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.