Show state of a device in Lovelace View only

Hello guys and girls,

I need help with this:

Show state of a device (switch in this case) in Lovelace, but view only, without the possibility to toggle the switch.

As I’m building a full HA operated hot tub, I want everyone in the household to see, what the machinery is doing, but not being able to change the states. They will only get two control buttons, Tub On and Tub Off.
This is mandatory, as there are combinations of states, which could case damage, if not operated by authorized user (me).

Like, pushing the heater on, when circulation pump of water is off is really an unwanted combi.

There will be an automated flow, which sets the states of the switches it self to start and stop the tub in the right order.

So it is really important, that there will be VIEW ONLY icons on that Lovelace card.

I found something, that looks usable: GitHub - iantrich/restriction-card: 🔒 Apply restrictions to Lovelace cards , but I see, the last edit in that repository was made 2 years back, so I’m afraid to use it, it could make some damage…

So anyone can help me on the right path with this?

I use the “restriction-card” and still works fine. I don’t use it for what you want to do so I don’t know if it has that functionality tho.

Or if that doesn’t work you could just create binary sensors from the switch state and display those instead of the actual switch.

1 Like

Thank you.

I was tonight also diving into the binary sensors. Will need to study a bit longer, before i get exactly, how it works. But it will do, what I want, thats already clear :wink:

1 Like

You can set buttons to have no action on tap or hold. I do this for a lot of my cards which I want to show state but not be able to change state:

  - type: button
    tap_action:
      action: none
    hold_action:
      action: none
    entity: input_boolean.ac_override_auto
    show_state: false
    name: AC auto override on?
    show_icon: true
    show_name: true
    icon_height: 42px

EDIT - better example

1 Like

So this button will change color dependant on state of the specified entity?

image

1 Like

Alternatively use a conditional card with a different icon…

This one has two buttons with different icons but only one of them displays at any one time, dependent on the state of the entity. Combine it with the tap/hold no action above and you’ll be sorted.

  - type: conditional
    conditions:
      - entity: binary_sensor.side_gate_sensor
        state: 'off'
    card:
      type: button
      entity: switch.side_gate_motor_control
      show_name: true
      show_icon: true
      name: Gate is closed
      icon: mdi:gate
  - type: conditional
    conditions:
      - entity: binary_sensor.side_gate_sensor
        state: 'on'
    card:
      type: button
      entity: switch.side_gate_motor_control
      show_name: true
      show_icon: true
      name: Gate is open
      icon: mdi:gate-open

image

1 Like

Thank you very much. I will get there now… :wink:

1 Like