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

tap_action per entity #31

Closed
SeLLeRoNe opened this issue Jan 24, 2020 · 10 comments
Closed

tap_action per entity #31

SeLLeRoNe opened this issue Jan 24, 2020 · 10 comments
Labels
enhancement New feature or request

Comments

@SeLLeRoNe
Copy link

Hi there,
first of all, thanks for this card, it is very useful for my current project :)

I would like to ask if it would be possible to have the "tap_action" to work for each defined entity so that I can decide nothing have to happen, or more spefiically for my case, to open a browser_mod.popup using call-service

Here what I am trying now:

                entities:
                  - type: custom:multiple-entity-row
                    entity: input_number.climate_t1_house_workday
                    icon: mdi:timer
                    primary:
                      entity: input_datetime.climate_t1_house_workday_start
                    secondary:
                      entity: input_datetime.climate_t1_house_workday_end
                    tap_action:
                      action: call-service
                      service: browser_mod.popup
                      service_data:
                        title: T1 Workday
                        card:
                          type: entities
                          entities:
                            - input_datetime.climate_t1_house_workday_start
                            - input_datetime.climate_t1_house_workday_end
                            - input_number.climate_t1_house_workday

Unfortuntately for now it seems that it is completely ignored, even if I set on each other entity to do nothing:

                    primary:
                      entity: input_datetime.climate_t1_house_workday_start
                      tap_action:
                        action: none

Would that be possible to integrate?

Thanks
Andrea

@SeLLeRoNe
Copy link
Author

SeLLeRoNe commented Jan 27, 2020

Ok, I found that there is a service call that can be performed directly inside the card but that doesn't work for the "whole card" (and even the tap_action is ignored for the "whole card")

Example:

    type: custom:multiple-entity-row
    name: '[[name]]'
    entity: input_number.climate_[[area]]_[[day]]_[[timing]]
    icon: mdi:timer
    primary:
      entity: input_boolean.climate_[[area]]_[[day]]_[[timing]]
      service: browser_mod.popup
      service_data:
        title: Configuration
        card:
          type: entities
          entities:
            - input_boolean.climate_[[area]]_[[day]]_[[timing]]
            - input_datetime.climate_[[area]]_[[day]]_[[timing]]_start
            - input_datetime.climate_[[area]]_[[day]]_[[timing]]_end
            - type: section
              label: Temperature
            - type: custom:slider-entity-row
              entity: input_number.climate_[[area]]_[[day]]_[[timing]]
              full_row: true
    secondary:
      entity: input_datetime.climate_[[area]]_[[day]]_[[timing]]_start
      service: browser_mod.popup
      service_data:
        title: Configuration
        card:
          type: entities
          entities:
            - input_boolean.climate_[[area]]_[[day]]_[[timing]]
            - input_datetime.climate_[[area]]_[[day]]_[[timing]]_start
            - input_datetime.climate_[[area]]_[[day]]_[[timing]]_end
            - type: section
              label: Temperature
            - type: custom:slider-entity-row
              entity: input_number.climate_[[area]]_[[day]]_[[timing]]
              full_row: true
    tertiary:
      entity: input_datetime.climate_[[area]]_[[day]]_[[timing]]_end
      service: browser_mod.popup
      service_data:
        title: Configuration
        card:
          type: entities
          entities:
            - input_boolean.climate_[[area]]_[[day]]_[[timing]]
            - input_datetime.climate_[[area]]_[[day]]_[[timing]]_start
            - input_datetime.climate_[[area]]_[[day]]_[[timing]]_end
            - type: section
              label: Temperature
            - type: custom:slider-entity-row
              entity: input_number.climate_[[area]]_[[day]]_[[timing]]
              full_row: true
    service: browser_mod.popup
    service_data:
      title: Configuration
      card:
        type: entities
        entities:
          - input_boolean.climate_[[area]]_[[day]]_[[timing]]
          - input_datetime.climate_[[area]]_[[day]]_[[timing]]_start
          - input_datetime.climate_[[area]]_[[day]]_[[timing]]_end
          - type: section
            label: Temperature
          - type: custom:slider-entity-row
            entity: input_number.climate_[[area]]_[[day]]_[[timing]]
            full_row: true

@benct benct added the enhancement New feature or request label Jan 31, 2020
@benct
Copy link
Owner

benct commented Jan 31, 2020

That's correct, the service call is not supported on the main entity at the moment. I'll try to get that implemented in the near future.

@SeLLeRoNe
Copy link
Author

Thank you very much :)

@benct
Copy link
Owner

benct commented Feb 4, 2020

Off-topic, but what are you using to handle the templating in the example above (climate_[[area]]_[[day]]_[[timing]])?

@SeLLeRoNe
Copy link
Author

Config Template Card: https://github.com/iantrich/config-template-card

@SeLLeRoNe
Copy link
Author

Correction, in that specific case it was the Decluttering Card: https://github.com/custom-cards/decluttering-card
Which does have some variables function which you can "pass on" the template you create so that it uses them (basically to allow you to create a template and pass the information you want to elaborate as variables, allowing you to use it multiple times for different reasons).

Sorry about the confusion.

@benct
Copy link
Owner

benct commented Feb 14, 2020

Implemented tap_action on main entity and moved sub entities service configuration into tap_action too, so to better match the default lovelace card configs.

@benct benct closed this as completed Feb 14, 2020
@SeLLeRoNe
Copy link
Author

Thanks!

It's working perfectly, except one thing :)

image

If I click on the "T7" I correctly got the popup, while if I click on the icon on the left I got the standard popup:
image

I think the icon should be part of the "main entity" tap_action ;)

@benct
Copy link
Owner

benct commented Feb 15, 2020

I just added the tap action on the state value itself because that is the way all other entity-rows behave. Try clicking on a default row and more-info dialog is shown on the icon and name, while an action (or nothing) is activated on a state click.

@SeLLeRoNe
Copy link
Author

mmmh, not 100% sure to be honest.
I do have an entity card where I set the tap_action to "none" and that is applied for the whole thing (including icon and name).

I tried to change it to more-info and I do have the popup on the icon and name, but oddly enough not on the state (person entity)

In the multiple-entity card it's happening the opposite somehow, I got the right popup on the state (T7 in the previous screenshot) and the "more-info" if I click on "thermostat" (text) and the icon

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

No branches or pull requests

2 participants