@bigbadblunt Thanks a lot for this, its working really great.
With the new v5 firmware for the lightwave.click event that are now generated, I’ve been wondering how best to monitor it - see Node-RED example below.
I’ve created some cool automation using Node-RED with utilising ‘attributes: lwrf_uiButtonPair’ with their respective code:
Code | Hex | Meaning |
---|---|---|
257 | 101 | Up button single press |
258 | 102 | Up button double press |
259 | 103 | Up button triple press |
260 | 104 | Up button quad press |
512 | 200 | Up button press and hold |
768 | 300 | Up button release after long press |
4353 | 1101 | Down button single press |
4354 | 1102 | Down button double press |
4355 | 1103 | Down button triple press |
4356 | 1104 | Down button quad press |
4608 | 1200 | Down button press and hold |
4864 | 1300 | Down button release after long press |
I couldn’t find any reference to ‘lightwave.click’ events in HA, mentioned in the github page?
The only issue I have with the way I’ve been monitoring the attribute changes, is that you only get that state attribute once (eg code 259 - up button pushed three time).
You wont get another state poll unless the ‘attribute: lwrf_uiButtonPair’ value has changed - I had no choice but to add the old_state to new_state comparison: if I operate the dimmer remotely, it would then initiate the three button automation when I wouldn’t want it to do so…
Node-RED example:
Push the up button three times (code 259) initiates my robot vacuum for that particular room and push the down button three times (code 4355) will send the vacuum back to the docking station.
[
{
"id": "8a2ded8dcece8ea1",
"type": "server-state-changed",
"z": "29ad2c77b6792cef",
"name": "Living Room",
"server": "a3c259717ed73a08",
"version": 3,
"exposeToHomeAssistant": false,
"haConfig": [
{
"property": "name",
"value": ""
},
{
"property": "icon",
"value": ""
}
],
"entityidfilter": "light.living_room_lights_v2",
"entityidfiltertype": "exact",
"outputinitially": false,
"state_type": "str",
"haltifstate": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"outputs": 1,
"output_only_on_state_change": false,
"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": 100,
"wires": [
[
"ba408f9855393a6a"
]
]
},
{
"id": "c1174516c3562c28",
"type": "switch",
"z": "29ad2c77b6792cef",
"name": "Is UP button pushed three times?",
"property": "data.new_state.attributes.lwrf_uiButtonPair",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "259",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 640,
"y": 60,
"wires": [
[
"d18b170166f6e3cc"
]
]
},
{
"id": "ba408f9855393a6a",
"type": "switch",
"z": "29ad2c77b6792cef",
"name": "",
"property": "data.new_state.attributes.lwrf_uiButtonPair",
"propertyType": "msg",
"rules": [
{
"t": "neq",
"v": "data.old_state.attributes.lwrf_uiButtonPair",
"vt": "msg"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 415,
"y": 100,
"wires": [
[
"c1174516c3562c28",
"5661a17e0f84bd58"
]
],
"l": false
},
{
"id": "c2082be92a4fa71f",
"type": "api-call-service",
"z": "29ad2c77b6792cef",
"name": "Send Cleany home",
"server": "a3c259717ed73a08",
"version": 3,
"debugenabled": false,
"service_domain": "homeassistant",
"service": "toggle",
"entityId": "script.send_cleany_back_home",
"data": "",
"dataType": "jsonata",
"mergecontext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 930,
"y": 120,
"wires": [
[]
]
},
{
"id": "5661a17e0f84bd58",
"type": "switch",
"z": "29ad2c77b6792cef",
"name": "Is DOWN button pushed three times?",
"property": "data.new_state.attributes.lwrf_uiButtonPair",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "4355",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 650,
"y": 120,
"wires": [
[
"c2082be92a4fa71f"
]
]
},
{
"id": "d18b170166f6e3cc",
"type": "api-call-service",
"z": "29ad2c77b6792cef",
"name": "Clean living room",
"server": "a3c259717ed73a08",
"version": 3,
"debugenabled": false,
"service_domain": "homeassistant",
"service": "toggle",
"entityId": "script.clean_livingroom",
"data": "",
"dataType": "jsonata",
"mergecontext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 930,
"y": 60,
"wires": [
[]
]
},
{
"id": "a3c259717ed73a08",
"type": "server",
"name": "Home Assistant",
"version": 1,
"legacy": false,
"addon": false,
"rejectUnauthorizedCerts": true,
"ha_boolean": "y|yes|true|on|home|open",
"connectionDelay": true,
"cacheJson": true
}
]