Weird "call-service" error when triggered from a lovelace UI button

Hey all,

I am seeing a strange issue when calling remote.send_command service from a UI element as its tap action. I am trying to build a custom remote controller UI in lovelace, and I am using the following sample code for one of the buttons:

type: custom:button-card
color: transparent
color_type: card
icon: mdi:arrow-left
size: 100%
styles:
  card:
    - height: 90px
    - width: 90px
    - color: var(--button-card-text-color)
    - border-radius: 50%
    - border: 1px solid var(--button-card-text-color)
    - background-color: var(--button-card-on-background)
tap_action:
  action: call-service
  service: remote.send_command
  data:
    device: '77622271'
    command: DirectionUp
  target:
    device_id: b1250f2888560dbbb3970b3378d08465

I have a Logitech Harmony remote that I am trying to send commands through. Following the instructions for the Harmony integration, I came up with the tap_action section seen above. When I use the developer tools to run the following service, it works just fine, and the command registers on my TV as expected:

service: remote.send_command
data:
  device: '77622271'
  command: DirectionUp
target:
  device_id: b1250f2888560dbbb3970b3378d08465

However, when the above service is called as part of the tap_action of the remote controller UI button, I get the following error appearing in the bottom left corner:

I obviously have data[‘command’] provided. I have tried putting the command in single quotes, but I still get the same error.

Here is where it gets interesting though: as far as I can tell, there is not a single entry about this in the Home Assistant logs. I even have my logging set to “debug”, so I can get as much detail logged as possible. But there is not a single entry regarding this error. When I intentionally introduce an unexpected key to the command, I get an error that also registers in the Home Assistant logs.

logger:
  default: debug
  logs:
    homeassistant.components.zha: debug
    zigpy: debug

Looking forward to some ideas here. Maybe I am doing something obviously wrong that someone can point out.

Thanks!

I did work around this issue by changing the command. I am sharing it below for people in the future in case they run into a similar issue. I do still think there might be a bug here, because the original command as I had it ran just fine through dev tools/services.

Here is my work around:

type: custom:button-card
color: transparent
color_type: card
icon: mdi:arrow-left
size: 100%
styles:
  card:
    - height: 90px
    - width: 90px
    - color: var(--button-card-text-color)
    - border-radius: 50%
    - border: 1px solid var(--button-card-text-color)
    - background-color: var(--button-card-on-background)
tap_action:
  action: call-service
  service: remote.send_command
  service_data:
    entity_id: remote.hub
    device: '77622271'
    command: DirectionUp

You’re using a custom card which is not provided by HA Core. The format of the service data in Dev Tools is not the same, per the card documentation: https://github.com/custom-cards/button-card#Action

1 Like

Yeah this caught someone else out on Discord yesterday. Only the core cards have changed to use data or service_data. Third party cards likely all still need service_data.

1 Like