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

Improvement on doc page #194

Closed
stinobook opened this issue May 2, 2023 · 7 comments
Closed

Improvement on doc page #194

stinobook opened this issue May 2, 2023 · 7 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@stinobook
Copy link

The Problem To Be Solved

Expansion of this page of the docs:
https://swiss-army-knife-card-manual.amoebelabs.com/basics/user-interactions/

Additional background:

Currently there is explained that you can put actions on individual SVG elements, yet you seem to have changed how it works.

Previous - entity based - looks like this worked like how we're used to. and im guessing we can then follow all possibilities from:
https://www.home-assistant.io/dashboards/actions/

now with your new version, the structure is different and its unclear what all possible actions are, since there is also slider interaction etc for your sliders.

Would it be possible to expand this page with all possible actions ?
single tap, double tap? hold? slider, ...

another thing i have also am unable to get working is the confirmation from the default HASS action.
does this also work with SAK or is it not implemented?
( https://www.home-assistant.io/dashboards/actions/#options-for-confirmation )

i want to use this to get a confirmation dialog before opening a garage door

@stinobook stinobook added the enhancement New feature or request label May 2, 2023
@stinobook
Copy link
Author

PS: do you want me to keep making issues like this about the documentation or not? you asked about this in one of my other tickets :)

grts

@AmoebeLabs
Copy link
Owner

PS: do you want me to keep making issues like this about the documentation or not? you asked about this in one of my other tickets :)

grts

Yup. As you said: there is lots of documentation, but due to the vast possibilities of this card, it is very difficult for me to know if there are loopholes that make it difficult to understand.

@AmoebeLabs
Copy link
Owner

Currently there is explained that you can put actions on individual SVG elements, yet you seem to have changed how it works.

Previous - entity based - looks like this worked like how we're used to. and im guessing we can then follow all possibilities from: https://www.home-assistant.io/dashboards/actions/

now with your new version, the structure is different and its unclear what all possible actions are, since there is also slider interaction etc for your sliders.

Most cards can only handle a single action, defined on the entity. That's how SAK started too, but became problematic after adding a lot of tools and the possibility to use any number of entities:

  • I needed different actions, on different tools, even when using the same entities

So that's why actions were moved to the tools section.

Would it be possible to expand this page with all possible actions ? single tap, double tap? hold? slider, ...

Yes that is possible. The only allowed action is tap and drag: I don't support double tap and hold.
Remember that this is all SVG, so I don't / can't use the HTML based libraries / objects that handle real buttons. I would have to find a library to do that for me or write one myself to support double tap and hold.

another thing i have also am unable to get working is the confirmation from the default HASS action. does this also work with SAK or is it not implemented? ( https://www.home-assistant.io/dashboards/actions/#options-for-confirmation )

i want to use this to get a confirmation dialog before opening a garage door

I haven't used confirmation dialogs yet, so this is not supported/implemented. I see that the (retired) custom button card does some sort of confirmation and that HA itself has its support in buttons, which more or less only asks if you are sure to do something or not.

In the case of SAK where you have different tools, that are not technically connected to each other, although it might visually look like they are, implementing this is a bit more difficult.

If you have a button and slider to control the lights, you don't want separate dialogs (I think) for both the button, and the slider. Once you have pushed the button for the light, you assume that you can control the slider, without any confirmation dialog.

The variations I see:

  • confirmation on card level
  • confirmation on toolset level (button and slider in 1 toolset --> a single confirmation)
  • confirmation on a single tool

Confirmations on a lower level (tools) take precedence over higher levels (card).

I have no idea if I can re-use the existing HA dialogs, which would be good for the consistency of the UI.

I must have a look in the sourcecode to find out if events are used for this, just like with the "more-info" dialog.

@AmoebeLabs AmoebeLabs added the documentation Improvements or additions to documentation label May 3, 2023
@stinobook
Copy link
Author

Would it be possible to expand this page with all possible actions ? single tap, double tap? hold? slider, ...

Yes that is possible. The only allowed action is tap and drag: I don't support double tap and hold. Remember that this is all SVG, so I don't / can't use the HTML based libraries / objects that handle real buttons. I would have to find a library to do that for me or write one myself to support double tap and hold.

idea for hold action: use the ' slider ' code you have right now, but remove the track part? since you can technically hold a slider in place and it doesn't do anything but i presume it still sends its updates and the configured interval
then you could just set the 'interval' as the time needed to hold the button until the action gets performed ?

another thing i have also am unable to get working is the confirmation from the default HASS action. does this also work with SAK or is it not implemented? ( https://www.home-assistant.io/dashboards/actions/#options-for-confirmation )
i want to use this to get a confirmation dialog before opening a garage door

I haven't used confirmation dialogs yet, so this is not supported/implemented. I see that the (retired) custom button card does some sort of confirmation and that HA itself has its support in buttons, which more or less only asks if you are sure to do something or not.

I haven't used confirmation yet either, but it looked like a simpler way to imitate the lock function from the custom button card (which is the option i used to prevent me accidentally opening garage doors :p )

i do believe now with your new release and the ability to hide tools, ill manage to make a makeshift lock that just hides the real button behind a fake toggle through helpers in HASS.

@stinobook
Copy link
Author

FYI, my fake lock works :')
not gonna make one per button but still.

Helper: toggle: cardlock
Automation:

alias: cardlock
description: ""
trigger:
  - platform: state
    entity_id:
      - input_boolean.cardlock
    to: "off"
    for:
      hours: 0
      minutes: 0
      seconds: 10
condition: []
action:
  - service: input_boolean.turn_on
    data: {}
    target:
      entity_id: input_boolean.cardlock
mode: single

add entity to the card and make a rectex as the final invisible layer:


                        - type: rectex
                          position:
                            cx: 50
                            cy: 50
                            width: 100
                            height: 100
                          entity_index: 1
                          user_actions:
                            tap_action:
                              haptic: light
                              actions:
                                - action: call-service
                                  service: input_boolean.turn_off
                          styles:
                            rectex:
                              fill: rgba(0,0,0,0)
                          animations:
                            - state: 'on'
                              styles:
                                rectex:
                                  display: initial
                            - state: 'off'
                              styles:
                                rectex:
                                  display: none

can also kind of use this as a fake double tap since first tap removes the lock and 2nd tap then does the interaction below it.

@AmoebeLabs
Copy link
Owner

See also

@AmoebeLabs
Copy link
Owner

The documentation page for User Interactions is updated for SAK v2.4.3

It includes a table for action types (tap and drag at this moment), the actions (more-info, navigate, call-service, and fire-dom-event), and some examples.

Other possible future user actions are described in #202

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

No branches or pull requests

2 participants