Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Since upgrading to 1.3.15 various script calls from card tap_action with service data fail #1597

Open
profahmad opened this issue Jan 6, 2025 · 4 comments
Labels

Comments

@profahmad
Copy link

I use a custom script to toggle lights and brightness from cards by passing in different variables. I was able to initiate these from the card_room and card_light cards but now get a version of the error in this bug: #1566

I fixed the card_room error by changing:

widget_icon_room:
  variables:
    tap_action:
      action: "toggle"
    hold_action:
      action: "more-info"
  tap_action:
    action: "[[[ return variables?.tap_action?.action ? variables.tap_action.action : 'none'; ]]]"
    entity: "[[[ return variables.tap_action.entity; ]]]"
    navigation_path: "[[[ return variables.tap_action.navigation_path; ]]]"
    url_path: "[[[ return variables.tap_action.url_path; ]]]"
    perform_action: "[[[ return variables.tap_action.service; ]]]"
    target: "[[[ return variables.tap_action.service_data; ]]]"
  hold_action:
    action: "[[[ return variables?.hold_action?.action ? variables.hold_action.action : 'none'; ]]]"
    entity: "[[[ return variables.hold_action.entity; ]]]"
    navigation_path: "[[[ return variables.hold_action.navigation_path; ]]]"
    url_path: "[[[ return variables.hold_action.url_path; ]]]"
    perform_action: "[[[ return variables.hold_action.service; ]]]"
    target: "[[[ return variables.hold_action.service_data; ]]]"

to:

widget_icon_room:
  variables:
    tap_action:
      action: "toggle"
    hold_action:
      action: "more-info"
  tap_action:
    action: "[[[ return variables?.tap_action?.action ? variables.tap_action.action : 'none'; ]]]"
    entity: "[[[ return variables.tap_action.entity; ]]]"
    navigation_path: "[[[ return variables.tap_action.navigation_path; ]]]"
    url_path: "[[[ return variables.tap_action.url_path; ]]]"
    perform_action: "[[[ return variables.tap_action.service; ]]]"
    service_data: "[[[ return variables.tap_action.service_data; ]]]"
  hold_action:
    action: "[[[ return variables?.hold_action?.action ? variables.hold_action.action : 'none'; ]]]"
    entity: "[[[ return variables.hold_action.entity; ]]]"
    navigation_path: "[[[ return variables.hold_action.navigation_path; ]]]"
    url_path: "[[[ return variables.hold_action.url_path; ]]]"
    perform_action: "[[[ return variables.hold_action.service; ]]]"
    service_data: "[[[ return variables.hold_action.service_data; ]]]"

I haven't found a fix for the card_light card, setting tap_action to 'call_service' and passing service data results in the error: Failed to perform the action script/SCRIPT_NAME. not a valid value for dictionary value @ data['target']['entity_id']. Got ''

@wilbiev
Copy link
Collaborator

wilbiev commented Jan 6, 2025

The release v1.3.15 should not affect card_room. This will be fixed in the next release. The proper code:

widget_icon_room:
  variables:
    tap_action:
      action: "toggle"
    hold_action:
      action: "more-info"
  tap_action:
    action: "[[[ return variables?.tap_action?.action ? variables.tap_action.action : 'none'; ]]]"
    entity: "[[[ return variables.tap_action.entity; ]]]"
    navigation_path: "[[[ return variables.tap_action.navigation_path; ]]]"
    url_path: "[[[ return variables.tap_action.url_path; ]]]"
    perform_action: "[[[ return variables.tap_action.service; ]]]"
    data: "[[[ return variables.tap_action.service_data; ]]]"
  hold_action:
    action: "[[[ return variables?.hold_action?.action ? variables.hold_action.action : 'none'; ]]]"
    entity: "[[[ return variables.hold_action.entity; ]]]"
    navigation_path: "[[[ return variables.hold_action.navigation_path; ]]]"
    url_path: "[[[ return variables.hold_action.url_path; ]]]"
    perform_action: "[[[ return variables.hold_action.service; ]]]"
    data: "[[[ return variables.hold_action.service_data; ]]]"
  size: "15px"
  color: "var(--google-grey)"
  show_icon: true
  show_name: false
  styles:
    icon:
      - width: "50%"
      - height: "50%"
      - line-height: "0"
      - color: "rgba(var(--color-theme),0.2)"
    img_cell:
      - border-radius: "50%"
      - background-color: "rgba(var(--color-theme),0.05)"
    grid:
      - grid-template-areas: "'i'"
    card:
      - height: "100%"
      - box-shadow: "none"
      - padding: "0px"
      - border-radius: "50%"

@profahmad
Copy link
Author

Ah sweet, thanks for that. I've noticed a similar issue with other cards today, I have a few card_generic cards with service calls and data that have the same error.

@profahmad
Copy link
Author

I've done a little digging through the template files and action_cards and noticed that adaptive is the new term to pass to ulm_card_tap_action in order to call a service with data. This works for my generic cards but not for the light_card, that default to opening a popup. Is there anything else I need to specify in my yaml to specifically call a service?

@wilbiev
Copy link
Collaborator

wilbiev commented Jan 9, 2025

In release v1.3.15 there is a bug in the action_card which is used by the generic_cards and light_card. This is related to issue #1598. The fiix is in PR: #1600. This will be fixed in next release. You can change the type of actions in the custom_actions.yaml which in in the same folder as ui-lovelace.yaml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants