Skip to content

Instantly share code, notes, and snippets.

@alexdelprete
Created March 11, 2023 22:41
Show Gist options
  • Save alexdelprete/a8d6ad98ae2c934f12606becd4b01b61 to your computer and use it in GitHub Desktop.
Save alexdelprete/a8d6ad98ae2c934f12606becd4b01b61 to your computer and use it in GitHub Desktop.
Nuki Hub Mushroom Card
type: custom:stack-in-card
cards:
- type: custom:mushroom-template-card
layout: horizontal
primary: >
{% set lock_name = state_attr('lock.portoncino','friendly_name') %} {% set
trigger = states('sensor.portoncino_trigger') %} {% if
is_state('lock.portoncino','unlocked') and
is_state('binary_sensor.portoncino_door_sensor','off') %}
{{ lock_name }}: closed & unlocked by {{ trigger }}
{% elif is_state('lock.portoncino','locked') and
is_state('binary_sensor.portoncino_door_sensor','off') %}
{{ lock_name }}: closed & locked by {{ trigger }}
{% elif is_state('lock.portoncino','unlocked') and
is_state('binary_sensor.portoncino_door_sensor','on') %}
{{ lock_name }}: open & unlocked by {{ trigger }}
{% else %}
{{ lock_name }}: state unknown!
{% endif %}
secondary: >
{% set battery_level = states('sensor.portoncino_battery_level') | int |
round(0) %} {% set bt_rssi_level =
states('sensor.portoncino_bluetooth_signal_strength') | int | round(0) %}
{% set wifi_rssi_level = states('sensor.portoncino_wifi_signal_strength')
| int | round(0) %} {% set uptime = states('sensor.portoncino_uptime') |
int %} Battery: {{ battery_level ~ '%' }} | BT: {{ bt_rssi_level ~ 'dBm'
}} | WiFi: {{ wifi_rssi_level ~ 'dBm' }} | Uptime: {{ uptime ~ 'm' if
(uptime|int) < 60 else ((uptime|int)/60)|round(1) ~ 'h' }}
icon: >
{% if is_state('lock.portoncino','unlocked') and
is_state('binary_sensor.portoncino_door_sensor','off') %}
mdi:door-closed
{% elif is_state('lock.portoncino','locked') and
is_state('binary_sensor.portoncino_door_sensor','off') %}
mdi:door-closed-lock
{% elif is_state('lock.portoncino','unlocked') and
is_state('binary_sensor.portoncino_door_sensor','on') %}
mdi:door-open
{% endif%}
icon_color: >
{% if is_state('lock.portoncino','locked') and
is_state('binary_sensor.portoncino_door_sensor','off') %}
green
{% elif is_state('lock.portoncino','unlocked') and
is_state('binary_sensor.portoncino_door_sensor','off') %}
yellow
{% elif is_state('lock.portoncino','unlocked') and
is_state('binary_sensor.portoncino_door_sensor','on') %} %}
red
{% endif%}
badge_icon: >
{% set battery_level = states('sensor.portoncino_battery_level') | int |
round(0) %} {% if battery_level < 80 %}
mdi:battery-{{ battery_level }}
{% elif battery_level < 60 %}
mdi:battery-alert-variant-outline
{% else %} {% endif %}
badge_color: >
{% set battery_level = states('sensor.portoncino_battery_level') | int |
round(0) %} {% if battery_level < 80 %}
orange
{% elif battery_level < 60 %}
red
{% else %}
green
{% endif %}
tap_action:
action: none
card_mod:
style: |
ha-card {
background: none;
box-shadow: none;
}
- type: custom:mushroom-lock-card
entity: lock.portoncino
name: Laundry Room Door
primary_info: none
secondary_info: none
icon_type: none
layout: vertical
card_mod:
style: |
ha-card {
background: none;
box-shadow: none;
}
@alexdelprete
Copy link
Author

Who's creating that binary_sensor? Check in the entities to which integration it is linked.

image

If it's MQTT, then it's Nuki Hub. If it's another integration, you shouldn't be using it together with Nuki Hub.

@thor9898
Copy link

thor9898 commented Apr 5, 2023

It was saying mqtt although it wasn't being shown inside the Nuki hub device I don't know why.
But never mind. 8.21 update fixed it and it's showing inside the Nuki hub device again now. I haven't tested it much, but it's working well now so, I won't disturb you anymore 😅😅😅

image

Ps: Again, I appreciate your willingness to help and giving me support for this issue, it's nice to find kind-hearted people on the internet that helps with kind words even with the dumbest things. I currently live in Spain in a non-tourist city at all but will most likely move to London in the near future as I have family there if you ever there and want a beer or cyder just let me know and it will be on me for sure, my Mediterranean brother!! Thank you very much

@alexdelprete
Copy link
Author

Don't worry my friend, it's nothing special. If you need anything, you know how to contact me. I'm also on Discord (alexdelprete#5566) and Telegram (@alexdelprete). :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment