Date Created:
Date Last Modified:



Description:
This code snippet is an example of a cover status. In this example, we are displaying the current status of a group of blinds to the user. This snippet uses the Mushroom Dashboard cards. Two things are happening here:
- The secondary information is dynamic and changes depending on the status of the entity (in this case “cover.basement_window_shades”):
- Open if the shade position is 0
- Closed if the position is 100
- Partially Open if the shade position is anything other that 0 or 100
- Similar to #1 the icon displayed is based on the status:
- mdi:window-closed if the shade position is at 100. Note: mdi:window-closed shows a window with no shade giving the user the impression that the shade is fully open.
- mdi:roller-shade-closed if the shade position is at 0.
- mdi:roller-shade if the shade is partially open.
Code:
- type: custom:mushroom-template-card
primary: Basement Shades
secondary: >-
{{ 'Open' if is_state_attr('cover.basement_window_shades',
'current_position', 100) else 'Closed' if
is_state_attr('cover.basement_window_shades', 'current_position', 0)
else 'Partially Open'}}
entity: cover.basement_window_shade_02
icon: >-
{{ 'mdi:window-closed' if
is_state_attr('cover.basement_window_shades', 'current_position',
100) else 'mdi:roller-shade-closed' if
is_state_attr('cover.basement_window_shades', 'current_position', 0)
else 'mdi:roller-shade'}}
icon_color: light-green