Adding text to switch to show status of garage door

I would like to have text displayed on my switch telling the status of my garage door (opened or closed) based on the sensor state (which his on/off). I’ve created a mock up image to show you what I’m looking to do.

garage

You need custom_ui…

1 Like

Do you need the switch itself?

If not a template sensor might be of help:

groups.yaml:

Garage:
  entities:
    - sensor.garage_door_state

sensors.yaml:

- platform: template
  sensors:
    garage_door_state:
      value_template: >- 
        {% if is_state('switch.your_garage_door_sensor', 'true') %}
          Open
        {% else %}
          Closed
        {% endif %}
      icon_template: >-
        {% if is_state('switch.your_garage_door_sensor', 'true') %}
          mdi:garage-open
        {% else %}
          mdi:garage
        {% endif %}
      friendly_name: 'Garage Door'

You might need to change true to false depending on your sensor’s feedback regarding what is reported as open.

To elaborate, the device is a Wemo Maker with a reed magnet sensor hooked up to it. I want the switch on my dashboard so I can open/close my garage from the UI. Right now it doesn’t clearly show me if the reed sensor is on or off (garage door open or closed). I want to be able to open up HA on my iphone and quickly see the status of my garage door.

I have tilt sensor that shows up in HA as a binary_sensor.

This is what I did in my customize.yaml to gt it to display “open/closed” instead of “on/off”

binary_sensor.garage_door_north_position_sensor:
  device_class: opening
  entity_picture: /local/garage-feat.png
  extra_data_template: Battery Level ${(entities['sensor.batt_garagedoor1'].state)}%

garage%20door

I think you can do the “device_class:” without andrey’s custom_ui.

1 Like

How do you determine what the binary sensor details are? Is it my switch name?

Why does the picture show the door clearly open when the caption is closed?

1 Like

the icon is just an MDI icon i added. I haven’t taken the time to animate it yet. I just look at the caption.

the binary sensor name itself is whatever you create it to be using whichever method is appropriate for your device type. in my case I defined it in my zwave configuration.

For the battery sensor you have to create using the attributes of the zwave entity. I can post the code for that later if you need it as I’m not at a place I can access my setup at the moment

Hi
I have created push button in glance card. It is switch with automation that after 1 sec change state from on to off. It is button to open garage dooor. Is any chance to state which should be show will be get from binary senor and show and change icon (garage and garageopen) on switch ? Or create template switch wich get function phisical switch but get icon and state from binary sensor on garage door ?