Garagentor Buttonanzeige nach Status

image

type: custom:button-card
entity: switch.garagentor_garagentor
name: Garagentor
size: 40%
icon: |

  [[[
   if (states['binary_sensor.0x00158d000a8198ff_contact'].state === "off")
   return "mdi:garage-lock" ;
   else if (states['binary_sensor.0x00158d000a8198ff_contact'].state === "on")
              return "mdi:garage-open" ;
          ]]]
styles:
  icon:
    - color: >
        [[[  

        if (states['binary_sensor.0x00158d000a8198ff_contact'].state == 'off')
          return "green";
        else if (states['binary_sensor.0x00158d000a8198ff_contact'].state ==
        'on')
           return "red";
        ]]] 


4 „Gefällt mir“