Not sure how this works in HA yaml since I use Node-RED, but the problem is you need to retain your MQTT message. If you don’t retain your MQTT message when you restart HA it will revert to the previous value stored in your broker.
Makes sense i thought the mqtt.publish service did exactly that. Obviously missed something
It was the retain flag! (so simple)
update_windows:
sequence:
- data_template:
payload_template: '{"timestamp": {{ as_timestamp (now()) | int }},"visible":true,"unit_of_measurement":"timestamp"}'
topic: homeassistant/sensor/windows/state
retain: true
service: mqtt.publish
alias: Update Windows
noob question, how do i integrate this into my hassbian running on ubuntu? sorry if this is too stupid to ask.
The way you’re running HA is irrelevant. I’d recommend using HACS to install the card and you also need some sort of MQTT broker.
I installed the Check Button Card using HACS. I added a test button to mu Lovelace UI using the Severity example. The button appears and everything looks ok and the button says “Entity doesn’t exist. Create?” I click the green check mark and the button changes to red and says “less than 1 minute ago”. However, it then changes back to the original button saying the entity doesn’t exist again. I do have a working mqtt broker set up in Home assistant. Did I miss something? Thanks.
thank you. after installing through HACS, it says NOT LOADED. This plugin is not added to your Lovelace resources
Not exactly sure what could be causing this. Check your entity states page to see if the sensor has been created. If it does exist try and see if restarting HA helps.
I’m running into an issue with figuring out how to show/hide cards and think I’m overthinking things. It’s my (limited) understanding that conditional cards can only show/hide based on ‘state’ and not attributes. I spent some time configuring a node-red flow that could read the timestamp and visibility_timeout attributes and worked out a mqtt push that would update the ‘visible’ attribute from true to false depending on logic, but realized that I couldn’t have the conditional card filter on that setting (that I’m aware of).
Am I overthinking things? Do I need to setup another sensor (binary or regular) that controls if the cards are visible? Many thanks for the useful card and much appreciated in advance to any pointers. Thanks!
Thanks for the reply. No entities are being created. I have tried restarting HA through the server controls as well as restarting the docker container. I am seeing messages on the MQTT broker ‘homeassistant/sensor/test_button/state/config’ topic, so that part is working. Any ideas on where to start troubleshooting?
Thanks.
It sounds like you don’t have MQTT discovery enabled if the topic is being created but you don’t see any entities in HA.
you don’t have MQTT discovery enabled
That was it! Thanks!
Thank you @Gluwc for this great work!
Is it possible to send a notification using a notify service when a button change severity (color)?
Unfortunately it’s not possible to send any notifications from the Lovelace frontend, as anything from the front end requires it to be open in a browser.
You can however use the timestamp from the sensor created by this card to set up an automation that sends a notification.
Hi @Gluwc, thank you for your answer!
Ok, I am doing so now. I would like to notify me when button goes from green to red. In my case, it happens after 4 days but instead of using this, I would prefer to create a variable I can change in the frontend so it will impact the button severity trigger and in the same time the automation for notification.
For this, I thought of creating an input_number. I am able to create it and I can check the value and change it as needed. However, I am not able to use it in the button severity. Do you know why? This is what I wrote:
I have no error message but the button rains red, no matter what is the time since I clicked.
Try 📝 100% Templatable Lovelace Configurations
This should let you use a templated value in your severity, I haven’t tried it myself though.
It works indeed, thank you!
Thank you for developing this card. I think I’m going to put it to good use. One small error in the HACS documentation under the link section at the end. I couldn’t get it to work until I changed null to module.
- url: /community_plugin/check-button-card/check-button-card.js
type: null
Big new release 1.0.0 with a bunch of breaking changes . Most things should be fairly easy to fix, but if you need any help let me know.
Great release, using this a lot now! Couple questions:
-
Can
display_limit
be multiple options as well? As a real-life example, I only want to see weeks when the timeout is more than 1 week out, until it’s less than a week left, then I want it to count down in days, and the last day I want it to count down in hours. Is that possible currently? -
Will you also add the ability to put in specific dates in the YAML, rather than the amount of time as timeout? That would be really helpful for certain things. See here: https://github.com/custom-cards/check-button-card/issues/12
Hey reckless, these are great suggestions. But neither are currently possible.
I did already have some ideas to add a display_mode
so you could have the time displayed as ‘1 week and 3 days ago’ or ‘1.5 weeks ago’.
I’ll see if I have some time soon to add some of these features.