Need some help with my dashboard (Lovelace) - integrating a push button and a binary sensor on a card

Okay so I finally made my driveway “smart” using a Z-Wave Shelly Qubino Wave 1 EU LR and an i4 DC EU LR (with a magnetic reed sensor attached to it), following my original topic from October last year. Won’t bother you with the details, I’ll update the original thread for those interested.

Basically I’ve got a momentary switch with auto turn off after 1 second with the Qubino Wave 1 (push it once - gate starts opening, push it again - the gate stops, push it again - the gate starts closing - just like a real remote), and a binary sensor using the i4. When the reed sensor magnets are close by (the driveway is closed) it lights up and says “On”, and when the gate is opened (the magnets are apart) it turns grey and reads “Off”. I’m pretty sure I have both devices configured properly in that regard.

I’ve spent hours with Google Gemini trying to create a card on my dashboard but we just kept spinning in circles with the occasional “Oh you’re right, my bad, you must be using the new and improved Home Assistant.” Basically, it kept trying to get me to add a Button or a Tile card (which don’t exist?), so for the time being I just added two favorites to my dashboard (circled red) which I would like to get rid of (they really don’t amount to much) and have them display on a separate card (currently the “Portun” entity card that has the arrow pointing to it). I literally started yelling at Gemini at one point, so here I am, no caps lock, hoping you guys can help out. “We”'ve tried Helpers, Automations… nothing worked.

This is what it currently looks like:

I would like to add a simple button (ideally a “power” button since the toggle button doesn’t make much sense - it’s a push button, not a toggle - with the text that would read either “Opened” or “Closed” above or below the button inside the “Portun” entity card (or whatever else I need). Opened would obviously be the i4’s “Off” and Closed the i4’s “On”.

Hopefully this can be done on the default dashboard - I’d really like to avoid using HACS for the time being or any yaml coding (and I’m hearing they’re getting rid of yaml with tomrorrow’s update anyway).

Any help would be much appreciated, thank you.

Edit: And the text “Off” below the “Portun” button top left means absolutely nothing since it’s configured as a momentary push switch - it’s just there. It does turn “On” until I press it again, but it’s irrelevant, I don’t even want it there.

LOL, are you hearing that from Gemini? Because it sounds like a hallucination to me… I’m on beta, there’s YAML.

Elsewise have you tried a simple button card? Use your i4’s state as the button’s entity state so that it shows on/off, open/closed or whatever its device class is set to display and map the tap action to your gates momentary switch.

No, a youtube video or two discussing beta (I couldn’t watch for more than 10 seconds so I may well be in the wrong).

As for the 2nd part of your reply, I’m afraid I’ll need a bit more than that to go on. I must be retarded or something. I click the three dots, Edit Overview, Add shortcut but there’s no Button anywhere?

Also is it even possible to do what I’m asking? Have a “Portun” card with both a “power” button and the text that reads either “Opened” or “Closed”?

They are migrating a single yaml section (http) to the UI. Yaml is not going away.

As for your thread, you should use a template switch which can do what you want.

template:
- switch:
  - name: Portun Gate
    unique_id: portun
    state: "{{ is_state('binary_sensor.portun', 'on') }}"
    turn_on:
    - action: switch.turn_on
      target:
        entity_id: switch.portun
    turn_off:
    - action: switch.turn_on
      target:
        entity_id: switch.portun

That’ll make a switch that you can put in your UI.

Or you can make a template cover

template:
- cover:
  - name: Portun Gate
    unique_id: portun
    state: "{{ is_state('binary_sensor.portun', 'on') }}"
    open_cover:
    - action: switch.turn_on
      target:
        entity_id: switch.portun
    close_cover:
    - action: switch.turn_on
      target:
        entity_id: switch.portun
    stop_cover:
    - action: switch.turn_on
      target:
        entity_id: switch.portun

Either way, this has been done many times before, it’s rock solid. Just hide your other entities after you make it.

Also, you don’t have to use yaml, you can make these in the UI too.

Sorry to be a bother, but I’m really bad at this. And I’d like to try out both options. Trying to translate what you wrote using Gemini to an UI friendly version, but if you could tell me how to do it via UI instead of Gemini I’d be in your debt :smiley:

I’m guessing I’d have to use the actual entity name instead of binary_sensor.portun, or?

ask gemini how to create a template switch helper in the UI.

The template itself (stuff in the {{ }}) requires the entity_id

Your first example has 2 turn_on: keys.

If by keys you mean actions - it’s for good reason - the switch/button needs to send an impulse (dry contact) both when the driveway is open (reed magnet sensors together) and closed (reed magnet sensors apart).

Omitting one of the turn on actions would let me open it, but not close it. It’s a push button, not a toggle switch.

Anyway, managed to create a helper - it’s not ideal, but until I muster up the willpower to dive into dashboards it gets the job done at a quick glance. The “Off” text is a bit off-putting, but it can’t be helped since it’s a switch. But it’s tied into the reed magnet sensor so the icon is yellow when the gate is open and grey when closed. Good enough for now.

I did try modifying that is_state statement with an if/else/iif and ‘open’ and ‘closed’ magic words as Gemini and Copilot suggested but couldn’t get it right. Kept getting a Syntax error (for the template cover, not the switch).

Here is what it looks like now:

I’ll have to do a deep dive into dashboards one of these days and make some sections or something.

Anyway, ty for the help :slight_smile:

Edit: If it is possible to modify that statement for a template cover to read “Open” and “Closed” instead of “Off/On” I’m all ears :smiley:

If you made a cover instead of a switch, it would have Open/Closed states.

No I meant the keys that the list of actions lives under, keys need to be unique. Anyways the example is fixed now

I just did yesterday :smiley: The switch doesn’t have the brains to choose whether to open or close once stopped (I’m guessing the curtain/blinds covers do, but for a garage door “hack”, it more than gets the job done :smiley:

Thanks again!