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

Rewrite ActionPanel to use Home Assistant default panel #1076

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MrBearPresident
Copy link
Collaborator

@MrBearPresident MrBearPresident commented Dec 22, 2024

Breaking change

  • None

Proposed change

  • Rewriting the ActionPanel to use Home Assistant default panel
    • Rename 'makeTapActionPanel' to makeActionPanel to be more in line with function.
    • Remove of how action panels where made.
    • Reuse home-assistant default action panel instead.
    • Rewrite how changed-actions are saved.

Type of change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

Everything was made in with the new action panels

type: custom:bubble-card
card_type: button
button_type: state
entity: sun.sun
tap_action:
  action: more-info
double_tap_action:
  action: navigate
  navigation_path: "#1"
hold_action:
  action: perform-action
  perform_action: input_boolean.toggle
  target:
    entity_id:
      - input_boolean.help_house_testboolean_01
      - input_boolean.help_house_testboolean_03
      - input_boolean.help_house_testboolean_02
sub_button:
  - entity: input_boolean.help_house_testboolean_01
    hold_action:
      action: url
      url_path: "#2"
    tap_action:
      action: toggle
    double_tap_action:
      action: more-info
button_action:
  tap_action:
    action: more-info
  double_tap_action:
    action: assist
    start_listening: true
  hold_action:
    action: none

Example printscreens/gif

image

Additional information

Additional documentation needed.

  • None

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests screenshots/gifs have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

  • Documentation added/updated for readme.

…ith function.

- Remove of how action panels where made.
- Reuse home-assistant default action panel instead.
- Rewrite how changed-actions are saved.
@Clooos
Copy link
Owner

Clooos commented Dec 22, 2024

Thank you so much! This was probably the worst part of the editor 😅

I can't wait to try this! 🎉

@Clooos
Copy link
Owner

Clooos commented Dec 23, 2024

I just tried it and this is almost perfect! There is just a use case that you removed, there was a new toggle for using the default entity instead of adding the same entity multiple times in the config, in YAML it was just "entity" instead of the entity id.

It's still working but without any toggle or instructions about that it's hard to guess. Can you add the toggle back, or do you have a better suggestion?

Edit: In YAML it looks like this:

    tap_action:
      action: call-service
      service: vacuum.start
      target:
        entity_id: entity

@MrBearPresident
Copy link
Collaborator Author

MrBearPresident commented Dec 23, 2024

Ah... Yes I remember you adding that switch.
But I never used it before and did not read all the code I delete so I forgot.

When I edit the yaml and try this. It does not work.

  action: perform-action
  perform_action: input_boolean.toggle
  target:
    entity_id: entity

Screenshot_20241223_124902_Vivaldi

When I change it to "call service" and "service" it does work.
Only big problem is that the default is actions now instead of service.

@Clooos
Copy link
Owner

Clooos commented Dec 23, 2024

Indeed I probably not covered this case, I always use call-service followed by service, I was not aware that it was a possibility.

@MrBearPresident
Copy link
Collaborator Author

MrBearPresident commented Dec 23, 2024

I will try if I find something that works, this evening.

@Clooos
Copy link
Owner

Clooos commented Dec 23, 2024

Thanks a lot!

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