Use of icons on a picture-elements card to build a remote control

I used picture elements with Harmony remote. Here is the code. I created a script for each command and placed them in another yaml file.

  - type: picture-elements
    image: /local/tvremotebig.png
    elements:
      - type: service-button
        title: Back
        service: script.turn_on
        service_data:
          entity_id: script.tv_go_back
        style:
          top: 63%
          left: 65%
      - type: service-button
        title: Right
        service: script.turn_on
        service_data:
          entity_id: script.tv_go_right
        style:
          top: 43%
          left: 65%
      - type: service-button
        title: Left
        service: script.turn_on
        service_data:
          entity_id: script.tv_go_left
        style:
          top: 45%
          left: 35%
      - type: service-button
        title: Pause
        service: script.turn_on
        service_data:
          entity_id: script.tv_go_pause
        style:
          top: 90%
          left: 50%
      - type: service-button
        title: OK
        service: script.turn_on
        service_data:
          entity_id: script.tv_go_ok
        style:
          top: 45%
          left: 50%
      - type: service-button
        title: Down
        service: script.turn_on
        service_data:
          entity_id: script.tv_go_down
        style:
          top: 55%
          left: 50%
      - type: service-button
        title: Up
        service: script.turn_on
        service_data:
          entity_id: script.tv_go_up
        style:
          top: 35%
          left: 50%
      - type: service-button
        title: Up
        service: script.turn_on
        service_data:
          entity_id: script.bose_up
        style:
          top: 38%
          left: 20%
      - type: service-button
        title: Down
        service: script.turn_on
        service_data:
          entity_id: script.bose_down
        style:
          top: 55%
          left: 20%

harmony.yaml:

script:
  tv_go_up:
    sequence:
      - service: remote.send_command
        data_template: { "device":50972604, "command":"DirectionUp"}
  tv_go_down:
    sequence:
      - service: remote.send_command
        data_template: { "device":50972604, "command":"DirectionDown"}
  tv_go_left:
    sequence:
      - service: remote.send_command
        data_template: { "device":50972604, "command":"DirectionLeft"}
  tv_go_right:
    sequence:
      - service: remote.send_command
        data_template: { "device":50972604, "command":"DirectionRight"}
  tv_go_back:
    sequence:
      - service: remote.send_command
        data_template: { "device":50972604, "command":"Back"}
  tv_go_menu:
    sequence:
      - service: remote.send_command
        data_template: { "device":50972604, "command":"Menu"}
  tv_go_home:
    sequence:
      - service: remote.send_command
        data_template: { "device":50972604, "command":"Home"}
  tv_go_power_toggle:
    sequence:
      - service: remote.send_command
        data_template: { "device":50972604, "command":"PowerToggle"}
  tv_go_pause:
    sequence:
      - service: remote.send_command
        data_template: { "device":50972604, "command":"Pause"}
  tv_go_ok:
    sequence:
      - service: remote.send_command
        data_template: { "device":50972604, "command":"OK"}
  bose_toggle:
    sequence:
      - service: remote.send_command
        data_template: { "device":45375003, "command":"PowerToggle"}
  bose_off:
    sequence:
      - service: remote.send_command
        data_template: { "device":45375003, "command":"PowerOff"}
  bose_on:
    sequence:
      - service: remote.send_command
        data_template: { "device":45375003, "command":"PowerOn"}
  bose_mute:
    sequence:
      - service: remote.send_command
        data_template: { "device":45375003, "command":"Mute"}
  bose_down:
    sequence:
      - service: remote.send_command
        data_template: { "device":45375003, "command":"VolumeDown"}
  bose_up:
    sequence:
      - service: remote.send_command
        data_template: { "device":45375003, "command":"VolumeUp"}

Here is the end result (still work-in-progress).

3 Likes