Customize Button-Card

Hey everyone,

I got a sensor on my garage that tells me if it is open or closed. I included that sensor (LCN) as a switch (off/on).
Is it posible to customize a Button, that tells me not “off” or “on” but “open” or “closed”? It would be very cool to setup a Icon for “open” and a Icon for “closed”. is that posible somehow?

thanks for everyones help

Its absolutely possible with this custom component.

But to begin with, Is there any problem integrating this as a binary sensor of the device_class garage_door instead of switch? It would have been the best method.

hey, thank you. I will look into it. the Problem ist, that I can’t get the LCN Integration to acceped a Switch as a binary sensor.

Can you share the LCN configuration that you use now? Also you can create a template binary sensor like below to

binary_sensor:
  - platform: template
    sensors:
      garage:
        friendly_name: "Window"
        value_template: "{{ is_state('switch.your_switch_here', 'on') }}"
        device_class: garage_door

hey,

ok. all wrong :slight_smile: (I though it was a switch, but it is a sensor for a LED) - sorry
on my lcn I setup a “LED” if the door is open (LED1 on= open; off=closed)

- name: Garagentor Status
  address: lcn.s0.m40
  source: LED1

on my map it looks like this:
image

Since the source is an LED, it cannot be configured as a binary sensor. In that case, the best option is to create a template cover sensor. Just add the following to the configuration.yaml.

cover:
  - platform: template
    covers:
      garage_door:
        device_class: garage
        friendly_name: "Garage Door"
        value_template: "{{ is_state('sensor.garagentor_status, 'on') }}"
        open_cover:
          service: switch.turn_on
          entity_id: switch.garasjeport
        close_cover:
          service: switch.turn_on
          entity_id: switch.garasjeport
        stop_cover:
          service: switch.turn_on
          entity_id: switch.garasjeport

If you have a smart switch that is used to operate this garage door you can change the corresponding entities under the open_cover, close_cover and stop_cover titles. If you dont have any entities just copy the following.

cover:
  - platform: template
    covers:
      garage_door:
        device_class: garage
        friendly_name: "Garage Door"
        value_template: "{{ is_state('switch.garasjeport_sensor_3', 'on') }}"
        open_cover:
        close_cover:
        stop_cover:

Please make sure the entity_ids are changed to yours.

1 Like

absolutely great. It worked just perfekt.
thank you for your help!