Thank you for this @jimpastos!
I have your HA Wink integration running, while also using it in conjunction with the STWinkRelay.apk
https://community.smartthings.com/t/beta-wink-relay-custom-smartthings-integration/111732.
The top button controls the bathroom light, while the bottom one controls the bathroom’s extraction fan and so this Wink Relay now replaces an electronic timer switch that had multiple settings of 10, 20, 30 & 60 minute durations.
I wrote a node-red flow(?) that lets me replicate the functionality of the timer switch using the MQTT button event topics, so that:
- 1 click = 10 minutes
- 2 clicks = 15 minutes
- 3 clicks = 20 minutes
I’m quite the newb at MQTT, node-red and HA in general so I’m quite proud of myself. If anyone wants to use the same flow, or show me how it could be improved, please take a look at the below:
[
{
"id": "afd2a74b.3c69d8",
"type": "tab",
"label": "Fan control timer",
"disabled": false,
"info": ""
},
{
"id": "da03f7e9.f40cc8",
"type": "mqtt in",
"z": "afd2a74b.3c69d8",
"name": "Fan Button Listener (1x)",
"topic": "Relay/buttons/1/click/1",
"qos": "2",
"datatype": "auto",
"broker": "dafc92a1.fc8ce",
"x": 100,
"y": 20,
"wires": [
[
"c278a14e.bad0e"
]
]
},
{
"id": "abd171d1.938df",
"type": "api-call-service",
"z": "afd2a74b.3c69d8",
"name": "Turn on Fan (10)",
"server": "337b22fd.b997ae",
"version": 1,
"service_domain": "switch",
"service": "toggle",
"entityId": "switch.master_bath_fan",
"data": "",
"dataType": "json",
"mergecontext": "",
"output_location": "",
"output_location_type": "none",
"mustacheAltTags": false,
"x": 320,
"y": 80,
"wires": [
[
"77dd7347.af699c"
]
]
},
{
"id": "2cbf97fa.8c21d8",
"type": "api-call-service",
"z": "afd2a74b.3c69d8",
"name": "Turn on Fan (15)",
"server": "337b22fd.b997ae",
"version": 1,
"service_domain": "switch",
"service": "toggle",
"entityId": "switch.master_bath_fan",
"data": "",
"dataType": "json",
"mergecontext": "",
"output_location": "",
"output_location_type": "none",
"mustacheAltTags": false,
"x": 320,
"y": 260,
"wires": [
[
"c1798a62.0b81a8"
]
]
},
{
"id": "2d36d2eb.0c0fae",
"type": "api-call-service",
"z": "afd2a74b.3c69d8",
"name": "Turn on Fan (20)",
"server": "337b22fd.b997ae",
"version": 1,
"service_domain": "switch",
"service": "toggle",
"entityId": "switch.master_bath_fan",
"data": "",
"dataType": "json",
"mergecontext": "",
"output_location": "",
"output_location_type": "none",
"mustacheAltTags": false,
"x": 320,
"y": 420,
"wires": [
[
"583b50e9.09567"
]
]
},
{
"id": "77dd7347.af699c",
"type": "ha-wait-until",
"z": "afd2a74b.3c69d8",
"name": "Timer (10)",
"server": "337b22fd.b997ae",
"outputs": 2,
"entityId": "switch.master_bath_fan",
"property": "state",
"comparator": "is",
"value": "1",
"valueType": "num",
"timeout": "10",
"timeoutUnits": "minutes",
"entityLocation": "",
"entityLocationType": "none",
"checkCurrentState": true,
"blockInputOverrides": true,
"x": 500,
"y": 80,
"wires": [
[],
[
"94c04950.6db018"
]
]
},
{
"id": "c1798a62.0b81a8",
"type": "ha-wait-until",
"z": "afd2a74b.3c69d8",
"name": "Timer (15)",
"server": "337b22fd.b997ae",
"outputs": 2,
"entityId": "switch.master_bath_fan",
"property": "state",
"comparator": "is",
"value": "1",
"valueType": "str",
"timeout": "15",
"timeoutUnits": "minutes",
"entityLocation": "",
"entityLocationType": "none",
"checkCurrentState": true,
"blockInputOverrides": true,
"x": 500,
"y": 260,
"wires": [
[],
[
"94c04950.6db018"
]
]
},
{
"id": "583b50e9.09567",
"type": "ha-wait-until",
"z": "afd2a74b.3c69d8",
"name": "Timer (20)",
"server": "337b22fd.b997ae",
"outputs": 2,
"entityId": "switch.master_bath_fan",
"property": "state",
"comparator": "is",
"value": "1",
"valueType": "str",
"timeout": "20",
"timeoutUnits": "minutes",
"entityLocation": "",
"entityLocationType": "none",
"checkCurrentState": true,
"blockInputOverrides": true,
"x": 500,
"y": 420,
"wires": [
[],
[
"94c04950.6db018"
]
]
},
{
"id": "94c04950.6db018",
"type": "api-call-service",
"z": "afd2a74b.3c69d8",
"name": "Turn off Fan",
"server": "337b22fd.b997ae",
"version": 1,
"service_domain": "switch",
"service": "turn_off",
"entityId": "switch.master_bath_fan",
"data": "",
"dataType": "json",
"mergecontext": "",
"output_location": "",
"output_location_type": "none",
"mustacheAltTags": false,
"x": 690,
"y": 180,
"wires": [
[]
]
},
{
"id": "5d2dbe42.b0fbf",
"type": "mqtt in",
"z": "afd2a74b.3c69d8",
"name": "Fan Button Listener (2x)",
"topic": "Relay/buttons/1/click/2",
"qos": "2",
"datatype": "auto",
"broker": "426ef3a3.09388c",
"x": 100,
"y": 180,
"wires": [
[
"d8e519bf.a34f28"
]
]
},
{
"id": "6bc8f206.de3d8c",
"type": "mqtt in",
"z": "afd2a74b.3c69d8",
"name": "Fan Button Listener (3x)",
"topic": "Relay/buttons/1/click/3",
"qos": "2",
"datatype": "auto",
"broker": "a76dc38a.2d32c",
"x": 100,
"y": 340,
"wires": [
[
"67dd7421.c4791c"
]
]
},
{
"id": "c278a14e.bad0e",
"type": "api-current-state",
"z": "afd2a74b.3c69d8",
"name": "Fan status",
"server": "337b22fd.b997ae",
"version": 1,
"outputs": 2,
"halt_if": "on",
"halt_if_type": "str",
"halt_if_compare": "is",
"override_topic": false,
"entity_id": "switch.master_bath_fan",
"state_type": "str",
"state_location": "payload",
"override_payload": "msg",
"entity_location": "data",
"override_data": "msg",
"blockInputOverrides": false,
"x": 290,
"y": 20,
"wires": [
[
"94c04950.6db018"
],
[
"abd171d1.938df"
]
]
},
{
"id": "d8e519bf.a34f28",
"type": "api-current-state",
"z": "afd2a74b.3c69d8",
"name": "Fan status",
"server": "337b22fd.b997ae",
"version": 1,
"outputs": 2,
"halt_if": "on",
"halt_if_type": "str",
"halt_if_compare": "is",
"override_topic": false,
"entity_id": "switch.master_bath_fan",
"state_type": "str",
"state_location": "payload",
"override_payload": "msg",
"entity_location": "data",
"override_data": "msg",
"blockInputOverrides": false,
"x": 290,
"y": 180,
"wires": [
[
"94c04950.6db018"
],
[
"2cbf97fa.8c21d8"
]
]
},
{
"id": "67dd7421.c4791c",
"type": "api-current-state",
"z": "afd2a74b.3c69d8",
"name": "Fan status",
"server": "337b22fd.b997ae",
"version": 1,
"outputs": 2,
"halt_if": "on",
"halt_if_type": "str",
"halt_if_compare": "is",
"override_topic": false,
"entity_id": "switch.master_bath_fan",
"state_type": "str",
"state_location": "payload",
"override_payload": "msg",
"entity_location": "data",
"override_data": "msg",
"blockInputOverrides": false,
"x": 290,
"y": 340,
"wires": [
[
"94c04950.6db018"
],
[
"2d36d2eb.0c0fae"
]
]
},
{
"id": "dafc92a1.fc8ce",
"type": "mqtt-broker",
"z": "",
"name": "MQTT-fan-button-listener-1",
"broker": "localhost",
"port": "1883",
"clientid": "node-red-01",
"usetls": false,
"compatmode": false,
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"willTopic": "",
"willQos": "0",
"willPayload": ""
},
{
"id": "337b22fd.b997ae",
"type": "server",
"z": "",
"name": "Home Assistant"
},
{
"id": "426ef3a3.09388c",
"type": "mqtt-broker",
"z": "",
"name": "MQTT-fan-button-listener-2",
"broker": "localhost",
"port": "1883",
"clientid": "node-red-02",
"usetls": false,
"compatmode": true,
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"willTopic": "",
"willQos": "0",
"willPayload": ""
},
{
"id": "a76dc38a.2d32c",
"type": "mqtt-broker",
"z": "",
"name": "MQTT-fan-button-listener-3",
"broker": "localhost",
"port": "1883",
"clientid": "node-red-03",
"usetls": false,
"compatmode": false,
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"willTopic": "",
"willQos": "0",
"willPayload": ""
}
]