usernein / tv-card

📺 TV Remote Card (with touchpad and haptic feedback)
Apache License 2.0
109 stars 28 forks source link

tv-card interraction with broadlink command #23

Closed Moustik2002 closed 2 years ago

Moustik2002 commented 2 years ago

Checklist:

**Release with the issue: v0.5.2 over HA 2022.10.4

**Last working release (if known): n/a

**Browser and Operating System:Firefox 105.0.3 Mac OS Ventura

Description of problem:

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

No specific bug to report. I just can't find specific configuration and argument to use vs marrobHD version to make your fork to accept Broadlink stuff

Additional information:

Here is the comand line i try to add to a specific Horizontal-stack card :

type: horizontal-stack
cards:
  - type: entities
    entities:
      - entity: input_boolean.tv
        name: TV
        tap_action:
          action: fire-dom-event
          browser_mod:
            service: browser_mod.popup
            data:
              style:
                border-radius: 20px
                '--ha-card-border-radius': 0px
              content:
                card: null
                type: custom:tv-card
                custom_keys:
                  power:
                    icon: mdi:power
                    service: remote.send.command
                    service_data:
                      device: "TCL TV"
                        command: Power
                        entity_id: remote.broadlink_bureau_remote

And the error message i've got :


    bad indentation of a mapping entry (24:25)

     21 |                     service: remote.send.command
     22 |                     service_data:
     23 |                       device: "TCL TV"
     24 |                         command: Power
    ------------------------------^
     25 |                         entity_id: remote.broadlink_bur ...
     26 |                 

Note : i'm not knowing too much about code, but i tried my best to avoid bothering you, but there i'm kinda lost.

Moustik2002 commented 2 years ago

nvm, i found out the solution. But i would suggest to maybe integrate the broadlink and apple TV feature in upcoming release like it was featured on marrobHD original project.

If someone bump into this issue, here is what i've done :

type: horizontal-stack
cards:
  - type: entities
    entities:
      - entity: media_player.apple_tv_bureau
        name: Apple TV
        tap_action:
          action: fire-dom-event
          browser_mod:
            service: browser_mod.popup
            data:
              style:
                border-radius: 20px
                '--ha-card-border-radius': 0px
              content:
                card: null
                type: custom:tv-card
                custom_keys:
                  power_tv:
                    icon: mdi:power
                    service: script.tcl_tv_power
                  source_tv:
                    icon: mdi:hdmi-port
                    service: script.tcl_tv_source
                  atv_down:
                    icon: mdi:arrow-down
                    service: script.atv_down
                  atv_home:
                    icon: mdi:home
                    service: script.atv_home
                  atv_home_hold:
                    icon: mdi:home-circle
                    service: script.atv_home_hold
                  atv_left:
                    icon: mdi:arrow-left
                    service: script.atv_left
                  atv_menu:
                    icon: mdi:menu
                    service: script.atv_menu
                  atv_right:
                    icon: mdi:arrow-right
                    service: script.atv_right
                  atv_select:
                    icon: mdi:keyboard-return
                    service: script.atv_select
                  atv_top_menu:
                    icon: mdi:arrow-left-top
                    service: script.atv_top_menu
                  atv_up:
                    icon: mdi:arrow-up
                    service: script.atv_up
                  atv_volume_down:
                    icon: mdi:volume-minus
                    service: script.atv_volume_down
                  atv_volume_up:
                    icon: mdi:volume-plus
                    service: script.atv_volume_up
                  atv_wakeup:
                    icon: mdi:apple
                    service: script.atv_wakeup
                entity: media_player.tcl_tv
                power_row:
                  - power_tv
                  - atv_wakeup
                  - source_tv
                channel_row:
                  - atv_home
                  - atv_volume_down
                  - atv_volume_up
                  - atv_menu
                source_row:
                  - null
                  - null
                  - atv_up
                  - null
                  - null
                apps_row:
                  - null
                  - atv_left
                  - atv_select
                  - atv_right
                  - null
                media_control_row:
                  - null
                  - null
                  - atv_down
                  - null
                  - null
        secondary_info: none
enrichman commented 1 year ago

The issue is a bit old but I was facing some issues so that's how I managed to solve them and integrate my Broadlink RM4 Mini.

I was able to get the device_id looking at the generated YAML in the "Developer Tools" > "Services" section when trying to manually trigger the command.

custom_keys:
  power:
    icon: mdi:power
    service: remote.send_command
    service_data:
      device: TV
      command: Power
      device_id:
      - fb04b6e2040b42367d7e252742cf4bb1

You can also specify the num_repeats, delay_secs and hold_secs parameters if needed:

custom_keys:
  power:
    icon: mdi:power
    service: remote.send_command
    service_data:
      num_repeats: 1
      delay_secs: 0.4
      hold_secs: 0
      device: TV
      command: Power
      device_id:
      - fb04b6e2040b42367d7e252742cf4bb1

Anyway your error of bad indentation means that the yaml is not well formatted. You had to delete a couple of spaces to have the command and entity_id keys aligned on the same column of the device key:

bad indentation of a mapping entry (24:25)

21 |                     service: remote.send.command
22 |                     service_data:
23 |                       device: "TCL TV"
24 |                         command: Power
------------------------------^
25 |                         entity_id: remote.broadlink_bur ...

fix:

21 |                     service: remote.send.command
22 |                     service_data:
23 |                       device: "TCL TV"
24 |                       command: Power
25 |                       entity_id: remote.broadlink_bur ...