Show html alert or any kind of popup?

Hi there!

I have an automation that when i click a button, it sends my vacuum to clean the rooms selected in a list of toggle entities, it works fine and i also added an if-else block there so it doesn’t do anything if the list of rooms is empty.

But i would like some popup or toast alert to be shown with something like “No Rooms Selected”.

I can’t find any easy way to do this, and the addons/integrations i’ve tried do other extra things that i dont need.

Any idea how to do this easily? Maybe i could just execute a typical JavaScript alert(“message”) somehow?

Thanks for the help!

I think that to make things simpler im just gonna add a conditional card there to show the button or just a text depending on the state of th array

Why don’t you just use the confirmation in tap_action? Or does this not work in your use case?

See here:

confirmation is what you’re looking for.

Oh thanks for that!
Im wondering now how would i conditionally show this confirmation.

im trying to just hide the button for now and it’s not working for some reason :confused:

  - type: horizontal-stack
    cards:
      - type: entities
        entities:
          - entity: input_boolean.select_all
      - type: conditional
        conditions:
          - condition: numeric_state
            entity_id: sensor.selected_rooms_count
            above: 0                        
            value_template: "{{ float(sensor.selected_rooms_count) }}"
        cards:
        - type: button
          show_icon: true
          show_name: true
          entity: input_button.go_clean
          name: Start cleaning
          icon_height: 25px
          tap_action:
            action: toggle

im getting “conditions are invalid” for some reason

I’m not sure, but does a numeric_state condition have a value_template? Doesn’t seem familiar to use it here. :slight_smile:

Check the documentation, if value_template is allowed here. And on second thought, does float really work as a function? I only use it as a filter (sensor.selected_room_counts | float).

Yeah i was testing stuff, in theory it should be ok, but even without that, the condition is “invalid” like this

- type: conditional
        conditions:
          - condition: numeric_state
            entity_id: sensor.selected_rooms_count
            above: 0       

k i got the conditional to work, but now the problem with the confirm is that it shows 'Are you sure?" as title without the possibility of changing it xD

Thanks for the help thought!

And what did you do to solve it? Might be interesting for future visitors to this thread. :slight_smile:

Take a look here for the dialog:

:slight_smile: Good you got it working!

EDIT: just as a suggestion, have you thought about running a loop over your counter? Sorry, don’t know how to describe it in better words, I mean something like this:

input_number:
  vacuum_segment_iterations:
    name: Staubsauger Durchläufe
    initial: 1
    min: 1
    max: 3
    step: 1
    mode: box

script:
  vacuum_iteration_count_up:
    alias: vacuum_iteration_count_up
    sequence:
      - choose:
          - conditions:
              - condition: template
                value_template: "{{ states('input_number.vacuum_segment_iterations') | int == 3 }}"
            sequence:
              - service: input_number.set_value
                target:
                  entity_id: input_number.vacuum_segment_iterations
                data:
                  value: '1'
        default:
          - service: input_number.increment
            target:
              entity_id: input_number.vacuum_segment_iterations

I’m using it this way, so I can iterate from 1 to 3 and back to 1. Like a slideshow. :slight_smile: Maybe worth a thought. :slight_smile: