How to show a status of a device only?

I like to show the status of a switch in de frontend without the possibility to change/ toggle the switch.
Just show “on” or “off”
I did try a boolean_input. But that is also switchable.
Any ideas??

A template sensor will do that.

Thanks, I will have a look

If you completely own your device it’s possible to do this directly on the switch with esphome :star2:

I’m doing something like that (exposing the relay state via binary_sensor to HA) but the it’s not possible to turn it off because of no exposed relay control.

Just a “restart” button can be pressed - forcing turning the relay off for 10 seconds and then on again. The same happens when the button on the plug is pressed - it will never be off permanently. :muscle:

I did write a template.
It is working

I did make a template:

template:
  - binary_sensor:
      - name: "Sproeier Status"
        state: "{{ states('switch.sproeier') }}"

That is working, but how to change the icon?
I tried to add icon_template: “mdi:radiobox_marked”
and picture: “mdi:radiobox_marked”
icon_template is unknown
and picture is not changing the icon?

you almost had it. :slight_smile:

icon:

And if you want to change it based on state then…

  icon:
    {% if is_state("switch.sproeier", "on") %}
      mdi:radiobox_marked
    {% else %}
      mdi:radiobox_unmarked
    {% endif %}

Thanks for the answer
icon: is also not working/ changing the icon
I tried that also

EDIT:
pfffffff stupid me it is: radiobox-marked instead of radiobox_marked

Thanks again