Hi,
I have a node red flow that turns on an extractor fan for 5 or 45 minutes based on how long the bathroom was occupied. To get a little more control I added a button to trigger 45 minutes extraction.
[{"id":"0daf051c73b28381","type":"ha-button","z":"d086a8d693d80fae","g":"a51738c6d16f6a57","name":"En Suite Fan button","version":0,"debugenabled":false,"outputs":1,"entityConfig":"1c04ae239cf74997","outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"x":290,"y":400,"wires":[["64712a781017c6a7"]]},{"id":"64712a781017c6a7","type":"api-call-service","z":"d086a8d693d80fae","g":"a51738c6d16f6a57","name":"","server":"2be748d3.da7088","version":5,"debugenabled":false,"domain":"fan","service":"turn_on","areaId":[],"deviceId":[],"entityId":["fan.en_suite_fan_switch"],"data":"{}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":550,"y":400,"wires":[["1433737141efce67"]]},{"id":"1433737141efce67","type":"delay","z":"d086a8d693d80fae","g":"a51738c6d16f6a57","name":"","pauseType":"delay","timeout":"45","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":870,"y":400,"wires":[["7212ec61447cea64"]]},{"id":"3ea29d85d8a4a214","type":"function","z":"d086a8d693d80fae","g":"a51738c6d16f6a57","name":"Fan 0, 5, 45 minutes","func":"var currentTime = new Date().getHours() * 100 + new Date().getMinutes();\n\nif ((currentTime >= 2200 && currentTime <= 2359) || \n (currentTime >= 0 && currentTime <= 700)) \n {\n return [{ msg }, null, null];\n }\nelse if ((currentTime >= 900 && currentTime <= 2200))\n {\n return [null, { msg }, null];\n }\nelse \n {\n return [null, null, { msg }];\n}","outputs":3,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":580,"y":340,"wires":[[],["ad096a1b0c1eaf97","f4c030925783df81"],["1433737141efce67"]],"outputLabels":["0","5","45"]},{"id":"7212ec61447cea64","type":"api-call-service","z":"d086a8d693d80fae","g":"a51738c6d16f6a57","name":"","server":"2be748d3.da7088","version":5,"debugenabled":false,"domain":"fan","service":"turn_off","areaId":[],"deviceId":[],"entityId":["fan.en_suite_fan_switch"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1050,"y":400,"wires":[[]]},{"id":"1cdfe35d6416dfdd","type":"server-state-changed","z":"d086a8d693d80fae","g":"a51738c6d16f6a57","name":"En Suite Fan is on","server":"2be748d3.da7088","version":5,"outputs":2,"exposeAsEntityConfig":"","entityId":"fan.en_suite_fan_switch","entityIdType":"exact","outputInitially":false,"stateType":"str","ifState":"off","ifStateType":"str","ifStateOperator":"is","outputOnlyOnStateChange":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":290,"y":340,"wires":[["3ea29d85d8a4a214"],[]]},{"id":"ad096a1b0c1eaf97","type":"delay","z":"d086a8d693d80fae","g":"a51738c6d16f6a57","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":860,"y":340,"wires":[["43b160993696aaea","f2efae0bf0f42ba7"]]},{"id":"f4c030925783df81","type":"debug","z":"d086a8d693d80fae","g":"a51738c6d16f6a57","name":"debug 350","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":830,"y":300,"wires":[]},{"id":"43b160993696aaea","type":"api-call-service","z":"d086a8d693d80fae","g":"a51738c6d16f6a57","name":"","server":"2be748d3.da7088","version":5,"debugenabled":false,"domain":"fan","service":"turn_off","areaId":[],"deviceId":[],"entityId":["fan.en_suite_fan_switch"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1050,"y":340,"wires":[["348f41aae8379790"]]},{"id":"f2efae0bf0f42ba7","type":"debug","z":"d086a8d693d80fae","g":"a51738c6d16f6a57","name":"debug 351","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1050,"y":300,"wires":[]},{"id":"348f41aae8379790","type":"debug","z":"d086a8d693d80fae","g":"a51738c6d16f6a57","name":"debug 352","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1230,"y":340,"wires":[]},{"id":"1c04ae239cf74997","type":"ha-entity-config","server":"2be748d3.da7088","deviceConfig":"","name":"button.bedroom_ensuite_extractor_45mins","version":"6","entityType":"button","haConfig":[{"property":"name","value":"En Suite Fan 45 Mins"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":""}],"resend":false,"debugEnabled":false},{"id":"2be748d3.da7088","type":"server","name":"Home Assistant","addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"","connectionDelay":false,"cacheJson":false,"heartbeat":true,"heartbeatInterval":"10","statusSeparator":"","enableGlobalContextStore":false}]
The manual button is exposed to ha as button.bedroom_ensuite_extractor_45mins
Is there a way to display a button that shows the state - Off or On (xx minutes remaining) ?