Yes sure, but I don’t think this would work, since last_changed isn’t an attribute. think it is states['sensor.qnapb3c_cpu_usage'].last_changed but you’d have to try, I didn’t use that in Buttons yet.
cool, that’s why I asked @RomRider if he would consider adding that feature, and he did! so nice when a component has true and dedicated development. Great you got it working. O, and you can add a line break in the template to have it show on an extra line.
When you use the color_type: card, the text and icon color will be either black or white based on the background luminance. You can override it by setting a fixed style for name
yes, Ive found out in the meantime, thanks this is working great at the moment. Ive even tested to have the default color set in the template and override it only when operator: template evaluates to true. Works like a charm!
ha, missed that copying from another template, thanks! Doesn’t really trouble since the config overrides the template…
but it can (should) be left out from the template in this setting probably, or at least be minimized to the haptic. Will see if they merge the way.
no that won’t work, the template should be a global HA template, so place (or reference) it in ui-lovelace.yaml.
Are you using yaml mode? If so you can do this (of course adapt to your file/folder structure):
##############################################################################################################
# Mqtt Hub Lovelace configuration file, calling all Views via !include /config/lovelace/view_***
# for ease of editing the separate Views, and prevent errors while doing so to the full setup
##############################################################################################################
title: Mqtt Hub Lovelace
resources: !include /config/lovelace/resources/resources.yaml
button_card_templates: !include lovelace/includes/button_card_templates.yaml
etcetc
and have the button_cards_templates.yaml contain the templates:
You can have the buttons call the MQTT service in the on tap action and then have something listen for the correct messages. I do all my logic in node red so i have node red listen for some mqtt actions. This is how I do the dim lights button below where it sends a message to mqtt and node red listens and dims some lights and turns some off.
I would like to have a card like yours for my fan/light. Right now I have the below setup but yours is much more compact.
If you want something that works right now, pop over to the fan-control-entity-row page and setup the custom card. This card works well is the inspiration behind my attempt to recreate it using button-card.
If you’d rather work from my incomplete configuration, here it is. As of now, the fan speed, on/off button and the button coloring are either incomplete. don’t work, or both. Also, don’t forget to change my entity ids to your own.
I offer this purely as a courtesy. As I said, this only partially works in my environment. I may abandon my efforts since it appears that to do this properly, I may have to learn Jinja 2 which may be outside of my capacity to do at this point. Good luck!
I think I’m attempting to do something unorthodox. I’m trying to check for the value in speed_list, an attribute of a fan entity and then apply coloring to the appropriate Low, Medium, High button. The snippet below would appear once in each card with the value low/medium/high where appropriate.
Am I doing this right? (Syntax adopted from a previous Mariusthvdb example.)
EDIT: After reading through the States section under Templating, I suspect I should be using return state_attr instead of return state but can’t seem to get that working either.