frontend icon indicating copy to clipboard operation
frontend copied to clipboard

"tap_action" needs differently defined "entity_id"

Open ildar170975 opened this issue 2 years ago • 14 comments

Checklist

  • [X] I have updated to the latest available Home Assistant version.
  • [X] I have cleared the cache of my browser.
  • [X] I have tried a different browser to see if it is related to my browser.

Describe the issue you are experiencing

Check these docs (https://www.home-assistant.io/dashboards/actions/#tap-action):

image

Means - I must define entity_id inside data section:

    tap_action:
      action: call-service
      service: input_boolean.toggle
      data:
        entity_id: input_boolean.test_boolean

But in practice I may use data, service_data, target:

type: entities
entities:
  - input_boolean.test_boolean
  - entity: sun.sun
    name: using data
    tap_action:
      action: call-service
      service: input_boolean.toggle
      data:
        entity_id: input_boolean.test_boolean
  - entity: sun.sun
    name: using service_data
    tap_action:
      action: call-service
      service: input_boolean.toggle
      service_data:
        entity_id: input_boolean.test_boolean
  - entity: sun.sun
    name: using target
    tap_action:
      action: call-service
      service: input_boolean.toggle
      target:
        entity_id: input_boolean.test_boolean

image

Seems that using data, service_data, target gives same result. Probably we should use ONE method and it must be reflected in docs correspondingly.

Now check a picture-entities card:

type: picture-elements
elements:
  - type: state-badge
    entity: sun.sun
    tap_action:
      action: call-service
      service: input_boolean.toggle
      target:
        entity_id: input_boolean.test_boolean
    style:
      top: 10%
      left: 10%
  - type: state-badge
    entity: sun.sun
    tap_action:
      action: call-service
      service: input_boolean.toggle
      data:
        entity_id: input_boolean.test_boolean
    style:
      top: 10%
      left: 50%
  - type: state-badge
    entity: sun.sun
    tap_action:
      action: call-service
      service: input_boolean.toggle
      service_data:
        entity_id: input_boolean.test_boolean
    style:
      top: 10%
      left: 30%
  - type: service-button
    title: input_boolean.toggle (target)
    service: input_boolean.toggle
    target:
      entity_id: input_boolean.test_boolean
    style:
      top: 22%
      left: 50%
  - type: service-button
    title: input_boolean.toggle (data)
    service: input_boolean.toggle
    data:
      entity_id: input_boolean.test_boolean
    style:
      top: 27%
      left: 50%
  - type: service-button
    title: input_boolean.toggle (service_data)
    service: input_boolean.toggle
    service_data:
      entity_id: input_boolean.test_boolean
    style:
      top: 32%
      left: 50%
image: /local/images/test/white.jpg

image

The state-badge element works with data, service_data, target, the service-button works with service_data only (as it is described in docs).

Here a similar situation: we should use ONE method which must be documented in docs.

Describe the behavior you expected

See above

Steps to reproduce the issue

See above

What version of Home Assistant Core has the issue?

2022.9.5

What was the last working version of Home Assistant Core?

No response

In which browser are you experiencing the issue with?

Chrome 105.0.5195.127

Which operating system are you using to run this browser?

Win10x64

State of relevant entities

No response

Problem-relevant frontend configuration

No response

Javascript errors shown in your browser console/inspector

No response

Additional information

No response

ildar170975 avatar Sep 20 '22 18:09 ildar170975

yeah, since core frontend use of service_data: on actions was changed to data:, this should at least be consistent throughout all core Frontend cards:

on Picture elements https://www.home-assistant.io/dashboards/picture-elements/#service-call-button, please streamline that to data:

Mariusthvdb avatar Sep 20 '22 18:09 Mariusthvdb

since core frontend use of service_data: on actions was changed to data:

There must be ONE method since in other places like here it is using target: image

It is confusing - using one syntax in Dev tools & automations, another in frontend.

ildar170975 avatar Sep 20 '22 18:09 ildar170975

yes, Frontend is a different beast than Backend. if that would be it, it would be ok-ish. But al least all Frontend should be consistent. Backend is for the most part.

Mariusthvdb avatar Sep 20 '22 19:09 Mariusthvdb

Ideally, Dev tools should be useful for building Lovelace & building backend. Here we can observe a scenario:

  1. I need to add a button with some service-call.
  2. Need to check this call first.
  3. Go to Dev tools -> Services -> select my service, select other data -> then "show as yaml" -> copy/paste into Lovelace.
  4. And the code may NOT work since there is a different syntax for frontend & backend. Luckily, currently frontend DOES support target & data (except service-button in piture-elements).

ildar170975 avatar Sep 20 '22 19:09 ildar170975

this issue (i don't know when it started allso prevents automatic dashboard and visual editor from working

in fact if i use visual editor it writes the code like this Screenshot_287 but as you can see it doesn't work and i have to manually rewrite it like this Screenshot_289

Shiroe93 avatar Oct 18 '22 22:10 Shiroe93

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jan 18 '23 10:01 github-actions[bot]

Up

ildar170975 avatar Jan 18 '23 12:01 ildar170975

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jul 01 '23 12:07 github-actions[bot]

up

ildar170975 avatar Jul 05 '23 21:07 ildar170975

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Oct 18 '23 23:10 github-actions[bot]

.

parautenbach avatar Oct 19 '23 13:10 parautenbach

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jan 17 '24 15:01 github-actions[bot]

up

ildar170975 avatar Jan 17 '24 21:01 ildar170975

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Apr 16 '24 23:04 github-actions[bot]

.

parautenbach avatar Apr 17 '24 07:04 parautenbach

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jul 16 '24 10:07 github-actions[bot]