UI
UI copied to clipboard
Enhancement: Conditional Confirmation
Recommend adding the following to every card. No reason not to and adds simple protection for critical devices.
If the variable is included in the card, the confirmation text is displayed. If the variable is not included, the card operates normally.
Card
variables:
custom_card_mwolter_power_outlet_confirm_text: Toggle the eGPU power?
Template
tap_action:
action: toggle
confirmation: '[[[ return variables.custom_card_mwolter_power_outlet_confirm_text == null ? false : {"text": variables.custom_card_mwolter_power_outlet_confirm_text} ]]]'
hold_action:
action: more-info
I think it's a good idea, but I'm not happy with the way of implementing it. It is additional code where we don't know how many people are really using it.
I'd suggest, we think of a better way to use that, something where the user can enable or disable it easily. But to be honest, how we should do that, I have no idea (yet). :)
If we can't find a better way, we should do it the mentioned way. :)
Thoughts?
EDIT: while thinking about it, should we just do a seperate card for that? We could just inherit the template from the card without confirmation and add a suffix for every card...
I'll write down some kind of code example as a POC (proof of concept) and put it in here.
Here we go, does that sound like a solid idea to go on with?
(Almost) every card gets a new template added, naming with a suffix like "_confirm". The new template would look something like this:
# button_card_templates.yaml
card_xy:
the code
card_xy_confirm:
templates:
- card_xy
variables:
ulm_card_xy_confirm_message: 'Really? Turning the light off in the middle of the evening?'
only new confirmation code added here
Looks good, and provides the option to assign tap_action: in the original card. But the variable should be in the actual lovelace yaml and not in a template, no?
Yes and no. :) The variable has to be in the "view" file, but to set a default, the variable will be definied in the template code as well. If the variable is set in "view", the other one will be overridden.
I've created a new branch for this feature and will work on it in the next days. But it may take some time, can't give any estimates.
ahh, right...thanks!
Is this possible the the Room Cards side entities? (entity_1, entity_2 etc.) A confirmation option would be nice!
Just adding my support to this request, particularly the Room Card side entities. I'd like a confirmation before turning off a switch.
I also would love to have this feature specifically for the Room card. I have some switches I'd like double checked before turning on. Unsure if there is a way to achive this rn since I'm very new to ULM, but already in love!
@Paddy0174 what is the progession on this function? I would like to use it on my power outlet cards.