diff --git a/examples/alexa_to_homeassistant.json b/examples/alexa_to_homeassistant.json index 5070e4b..dd10281 100644 --- a/examples/alexa_to_homeassistant.json +++ b/examples/alexa_to_homeassistant.json @@ -2,7 +2,7 @@ { "id": "affffc88a48e1001", "type": "subflow", - "name": "Alexa -> Homeassistant", + "name": "Alexa -> Home Assistant", "info": "", "category": "", "in": [{ "x": 60, "y": 80, "wires": [{ "id": "2565add7dc2c886d" }] }], @@ -22,8 +22,9 @@ "type": "function", "z": "affffc88a48e1001", "name": "convert", - "func": "const directiveToService = {\n TurnOff: \"turn_off\",\n TurnOn: \"turn_on\",\n SetBrightness: \"turn_on\",\n SetColorTemperature: \"turn_on\",\n SetColor: \"turn_on\"\n}\n\nconst {domain, entityId} = msg.metadata\n\nconst service = directiveToService[msg.payload.directive]\n\nnode.status({\n fill: service == 'turn_on' ? 'yellow' : 'grey',\n shape: 'dot',\n text: msg.payload.directive\n})\n\nreturn {\n payload: {\n domain,\n service,\n data: {\n entity_id: domain + \".\" + entityId,\n ...(service === \"turn_on\" & msg.payload.brightness !== undefined && { brightness_pct: msg.payload.brightness}),\n ...(service === \"turn_on\" & msg.payload.color_xy !== undefined && msg.payload.lightMode === \"hsb\" && { color_xy: msg.payload.color_xy }),\n ...(service === \"turn_on\" & msg.payload.colorTemperatureInKelvin !== undefined & msg.payload.lightMode === \"temp\" && { color_temp: msg.payload.colorTemperatureInKelvin}) }\n }\n}", + "func": "const directiveToService = {\n TurnOff: \"turn_off\",\n TurnOn: \"turn_on\",\n SetBrightness: \"turn_on\",\n SetColorTemperature: \"turn_on\",\n SetColor: \"turn_on\"\n}\n\nconst {domain, entityId} = msg.metadata ?? {}\n\nconst service = directiveToService[msg.payload.directive]\n\nnode.status({\n fill: service == 'turn_on' ? 'yellow' : 'grey',\n shape: 'dot',\n text: msg.payload.directive\n})\n\nreturn {\n payload: {\n domain,\n service,\n data: {\n entity_id: domain + \".\" + entityId,\n ...(service === \"turn_on\" & msg.payload.brightness !== undefined && { brightness_pct: msg.payload.brightness}),\n ...(service === \"turn_on\" & msg.payload.color_xy !== undefined && msg.payload.lightMode === \"hsb\" && { color_xy: msg.payload.color_xy }),\n ...(service === \"turn_on\" & msg.payload.colorTemperatureInKelvin !== undefined & msg.payload.lightMode === \"temp\" && { color_temp: msg.payload.colorTemperatureInKelvin}) }\n }\n}", "outputs": 1, + "timeout": "", "noerr": 0, "initialize": "", "finalize": "", @@ -38,14 +39,16 @@ "z": "affffc88a48e1001", "name": "", "server": "", - "version": 3, + "version": 5, "debugenabled": false, - "service_domain": "", + "domain": "", "service": "", - "entityId": "", + "areaId": [], + "deviceId": [], + "entityId": [], "data": "", "dataType": "jsonata", - "mergecontext": "", + "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", @@ -79,7 +82,7 @@ "z": "3156dd60.366d12", "name": "Kitchen Light", "topic": "", - "metadata": "{\"domain\":\"light\",\"entityId\":\"kitchen_light\"}", + "metadata": "{\"domain\":\"light\",\"entityId\":\"kitchen\"}", "connection": "", "template": "SWITCH", "retrievable": false, @@ -95,7 +98,7 @@ "id": "f057c4815e3be504", "type": "subflow:affffc88a48e1001", "z": "3156dd60.366d12", - "name": "Alexa -> Homeassistant", + "name": "", "x": 430, "y": 280, "wires": []