Here is a working example of restriciton card
This is when the door is locked
and when it is unlocked
type: custom:layout-card
square: false
columns: 1
cards:
- type: custom:restriction-card
restrictions:
pin:
code: 1234
exemptions:
- user: ianid
card:
type: custom:mushroom-template-card
secondary: null
primary: >
{% if is_state('binary_sensor.ewelink_contactsensor',
'on') %}
Door is Open
{% elif is_state('binary_sensor.ewelink_contactsensor',
'off') %}
Door is Locked
{% else %}
{% endif %}
entity: entity.entity
icon: null
tap_action:
action: call-service
service: script.turn_on
target:
entity_id: script.house_door
fill_container: false
multiline_secondary: false
layout: vertical
picture: /local/png/dot2.png
card_mod:
style:
mushroom-state-info$: |
.primary {
font-size: 16px !important;
position: relative;
overflow: visible !important;
margin-top: 30px;
margin-left: -12px;
--primary-text-color: rgb(var(--rgb-white));
font-weight: bold;
text-overflow: ellipsis;
text-align: left;
width: 130px;
background: rgb(0,100,182);
text-indent: 5px;
border-radius: 5px;
}
.secondary {
font-size: 14px !important;
position: static;
text-align: center;
margin-left: -18px;
border-radius: 5px;
margin-right: 2px;
background: rgb(0,100,182);
text-indent: 10px;
flex-wrap: wrap !important;
--secondary-text-color: var(--amber-color);
}
mushroom-shape-avatar$: |
.picture {
border-radius: 0px !important;
margin-top: 0px;
margin-left: 0px;
margin-bottom: auto;
}
mushroom-shape-icon$: |
.shape {
position: relative;
border-radius: 0px !important;
}
.: >
ha-card {
{% if
is_state('binary_sensor.ewelink_contactsensor',
'on') %}
background: url( '/local/png/live/door-open.png' ) no-repeat center 0px;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
background-blend-mode: hard-light;
flex-wrap: wrap !important;
position: relative;
{% elif
is_state('binary_sensor.ewelink_contactsensor',
'off') %}
background: url( '/local/png/live/door-closed4.png' ) no-repeat center 0px;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
background-color: rgba(150,58,27, 0.9);
position: relative;
{% else %}
background: url( '/local/png/11.png' ) no-repeat center 0px;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
background-color: #1a1a2a;, 1.25);
position: relative;
}
{% endif %}
--secondary-text-color: grey;
box-shadow: none !important;
background-color: rgba(250,130,43, 0.9);
height: 170px !important;
}
:host {
--mush-icon-size: 70px;
}
layout_type: custom:vertical-layout