home-assistant / frontend

:lollipop: Frontend for Home Assistant
https://demo.home-assistant.io
Other
3.99k stars 2.72k forks source link

"tap_action" needs differently defined "entity_id" #13827

Closed ildar170975 closed 2 months ago

ildar170975 commented 2 years ago

Checklist

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

Mariusthvdb commented 2 years ago

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:

ildar170975 commented 2 years ago

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.

Mariusthvdb commented 2 years ago

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.

ildar170975 commented 2 years ago

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).
github-actions[bot] commented 1 year ago

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.

ildar170975 commented 1 year ago

Up

github-actions[bot] commented 1 year ago

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.

ildar170975 commented 1 year ago

up

github-actions[bot] commented 11 months ago

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.

parautenbach commented 11 months ago

.

github-actions[bot] commented 8 months ago

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.

ildar170975 commented 8 months ago

up

github-actions[bot] commented 5 months ago

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.

parautenbach commented 5 months ago

.

github-actions[bot] commented 2 months ago

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.