From 1401b7683e1abde572bae5f71cf073194cfc214d Mon Sep 17 00:00:00 2001 From: Lucas Bramlage <38736396+Gluwc@users.noreply.github.com> Date: Sat, 16 Nov 2019 15:44:40 +0100 Subject: [PATCH 1/2] removed version requirement --- check-button-card.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/check-button-card.js b/check-button-card.js index 80d4c2d..dfc1347 100644 --- a/check-button-card.js +++ b/check-button-card.js @@ -337,9 +337,6 @@ class CheckButtonCard extends HTMLElement { this._showConfigBar(); } if(hass.states[config.entity] != undefined){ - if(hass.states[config.entity].attributes.version != config.required_version){ - this._showUpdateBar(); - } if(hass.states[config.entity].attributes.unit_of_measurement != "timestamp" && this._configSet != true){ this._showConfigBar(); } @@ -716,4 +713,4 @@ class CheckButtonCard extends HTMLElement { } } -customElements.define('check-button-card', CheckButtonCard); \ No newline at end of file +customElements.define('check-button-card', CheckButtonCard); From 0879164fd4ee859dc78cd8ac2d01745e6e8f1590 Mon Sep 17 00:00:00 2001 From: DrJeff Date: Mon, 25 Nov 2019 21:13:37 -0800 Subject: [PATCH 2/2] sensor add state to end --- README.md | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1b793f0..f339701 100644 --- a/README.md +++ b/README.md @@ -25,12 +25,34 @@ The visibility timeout can be used in combination with a conditional card to sho It is possible to publish to the MQTT topic using automations to update the button state using physical buttons for example (instead of using the UI button). -The payload should be published to the relevant sensor. If you sensor is named `sensor.test_button` the topic should be `homeassistant/test_button`. For more information check out the Home Assistant [documentation](https://www.home-assistant.io/docs/mqtt/discovery/). +The payload should be published to the relevant sensor. If you sensor is named `sensor.test_button` the topic should be `homeassistant/sensor/test_button/state`. For more information check out the Home Assistant [documentation](https://www.home-assistant.io/docs/mqtt/discovery/). ### Payload Example ``` json {"timestamp":"**timestamp here**","visibility_timeout":"2 hours","visible":true,"unit_of_measurement":"timestamp"} ``` +### Node Red Example +``` +// Define entity_id +const entityId = "sensor.test_button"; + +// Get global object +const haObject = global.get("homeassistant"); + +// Get attributes object from entity +let payloadObject = haObject.homeAssistant.states[entityId].attributes; + +// Get current timestamp in seconds +const currentTime = Math.trunc(Date.now()/1000); + +// Modify timestamp in payloadObject. +payloadObject.timestamp = currentTime; + +// Create string from object +msg.payload = JSON.stringify(payloadObject); + +return msg; +``` ## Options