[ { "id": "b314a7e.63eb258", "type": "http in", "z": "aa3ea19a.102458", "name": "", "url": "/simple", "method": "post", "upload": false, "swaggerDoc": "", "x": 270, "y": 520, "wires": [ [ "b00c5c21.673f68" ] ] }, { "id": "710606f5.91d88", "type": "http response", "z": "aa3ea19a.102458", "name": "", "statusCode": "", "headers": {}, "x": 1710, "y": 540, "wires": [] }, { "id": "fa7d4a0c.e88ce", "type": "debug", "z": "aa3ea19a.102458", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "x": 790, "y": 480, "wires": [] }, { "id": "b00c5c21.673f68", "type": "switch", "z": "aa3ea19a.102458", "name": "not ping", "property": "payload.request.command", "propertyType": "msg", "rules": [ { "t": "neq", "v": "ping", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 1, "x": 440, "y": 520, "wires": [ [ "b379ff32.9d3ca8" ] ] }, { "id": "38ed2048.87a69", "type": "switch", "z": "aa3ea19a.102458", "name": "user", "property": "payload.session.user_id", "propertyType": "msg", "rules": [ { "t": "eq", "v": "AliceSettings.userId", "vt": "flow" }, { "t": "else" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 770, "y": 520, "wires": [ [ "53c269d4.71d868" ], [ "571050d.b77bd3" ] ] }, { "id": "571050d.b77bd3", "type": "template", "z": "aa3ea19a.102458", "name": "go away", "field": "payload", "fieldType": "msg", "format": "json", "syntax": "mustache", "template": "{\n \"response\": {\n \"text\": \"{{payload.const.intruderText}}\",\n \"end_session\": false\n },\n \"session\": {\n \"session_id\": \"{{payload.session.session_id}}\",\n \"message_id\": 4,\n \"user_id\": \"{{payload.session.user_id}}\"\n },\n \"version\": \"1.0\"\n}", "output": "json", "x": 1480, "y": 460, "wires": [ [ "710606f5.91d88" ] ] }, { "id": "53c269d4.71d868", "type": "switch", "z": "aa3ea19a.102458", "name": "entity", "property": "payload.request.command", "propertyType": "msg", "rules": [ { "t": "cont", "v": "AliceSettings.entities.tableLamp", "vt": "flow" }, { "t": "cont", "v": "AliceSettings.entities.kitchenDownlight", "vt": "flow" }, { "t": "empty" }, { "t": "else" } ], "checkall": "true", "repair": false, "outputs": 4, "x": 950, "y": 560, "wires": [ [ "44573ac3.eba984" ], [ "5eb6825a.efc654" ], [ "dab350f1.624218" ], [ "8c2cad0.145915" ] ] }, { "id": "255ec3ef.f72aec", "type": "api-call-service", "z": "aa3ea19a.102458", "name": "", "server": "a4a77115.ad3c9", "service_domain": "light", "service": "turn_on", "data": "{\"entity_id\":\"light.table_lamp\"}", "render_data": false, "mergecontext": "", "output_location": "payload", "output_location_type": "msg", "x": 1310, "y": 560, "wires": [ [] ] }, { "id": "44573ac3.eba984", "type": "switch", "z": "aa3ea19a.102458", "name": "turn on/off", "property": "payload.request.command", "propertyType": "msg", "rules": [ { "t": "cont", "v": "включ", "vt": "str" }, { "t": "cont", "v": "выключ", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 1110, "y": 580, "wires": [ [ "255ec3ef.f72aec", "5fd37691.0ca64" ], [ "c94990c1.7bcfa", "a285d32d.9e91b8" ] ] }, { "id": "c94990c1.7bcfa", "type": "api-call-service", "z": "aa3ea19a.102458", "name": "", "server": "a4a77115.ad3c9", "service_domain": "light", "service": "turn_off", "data": "{\"entity_id\":\"light.table_lamp\"}", "render_data": false, "mergecontext": "", "x": 1310, "y": 600, "wires": [ [] ] }, { "id": "a39a7b44.ea2ec", "type": "api-call-service", "z": "aa3ea19a.102458", "name": "", "server": "a4a77115.ad3c9", "service_domain": "light", "service": "turn_off", "data": "{\"entity_id\":\"light.yeelight_strip_7811dcdc0624\"}", "render_data": false, "mergecontext": "", "output_location": "payload", "output_location_type": "msg", "x": 1310, "y": 680, "wires": [ [] ] }, { "id": "3d8e70de.70924", "type": "api-call-service", "z": "aa3ea19a.102458", "name": "", "server": "a4a77115.ad3c9", "service_domain": "light", "service": "turn_on", "data": "{\"entity_id\":\"light.yeelight_strip_7811dcdc0624\"}", "render_data": true, "mergecontext": "", "output_location": "payload", "output_location_type": "msg", "x": 1310, "y": 640, "wires": [ [] ] }, { "id": "5eb6825a.efc654", "type": "switch", "z": "aa3ea19a.102458", "name": "turn on/off", "property": "payload.request.command", "propertyType": "msg", "rules": [ { "t": "cont", "v": "включ", "vt": "str" }, { "t": "cont", "v": "выключ", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 1110, "y": 620, "wires": [ [ "3d8e70de.70924", "5fd37691.0ca64" ], [ "a39a7b44.ea2ec", "a285d32d.9e91b8" ] ] }, { "id": "5fd37691.0ca64", "type": "template", "z": "aa3ea19a.102458", "name": "turn on", "field": "payload", "fieldType": "msg", "format": "json", "syntax": "mustache", "template": "{\n \"response\": {\n \"text\": \"{{payload.const.turnOnText}}\",\n \"end_session\": false\n },\n \"session\": {\n \"session_id\": \"{{payload.session.session_id}}\",\n \"message_id\": 4,\n \"user_id\": \"{{payload.session.user_id}}\"\n },\n \"version\": \"1.0\"\n}", "output": "json", "x": 1500, "y": 580, "wires": [ [ "710606f5.91d88" ] ] }, { "id": "8c2cad0.145915", "type": "template", "z": "aa3ea19a.102458", "name": "not found", "field": "payload", "fieldType": "msg", "format": "json", "syntax": "mustache", "template": "{\n \"response\": {\n \"text\": \"{{payload.const.notFoundText}}\",\n \"end_session\": false\n },\n \"session\": {\n \"session_id\": \"{{payload.session.session_id}}\",\n \"message_id\": 4,\n \"user_id\": \"{{payload.session.user_id}}\"\n },\n \"version\": \"1.0\"\n}", "output": "json", "x": 1480, "y": 500, "wires": [ [ "710606f5.91d88" ] ] }, { "id": "a285d32d.9e91b8", "type": "template", "z": "aa3ea19a.102458", "name": "turn off", "field": "payload", "fieldType": "msg", "format": "json", "syntax": "mustache", "template": "{\n \"response\": {\n \"text\": \"{{payload.const.turnOffText}}\",\n \"end_session\": false\n },\n \"session\": {\n \"session_id\": \"{{payload.session.session_id}}\",\n \"message_id\": 4,\n \"user_id\": \"{{payload.session.user_id}}\"\n },\n \"version\": \"1.0\"\n}", "output": "json", "x": 1500, "y": 620, "wires": [ [ "710606f5.91d88" ] ] }, { "id": "7ab7aa6c.1cb3cc", "type": "template", "z": "aa3ea19a.102458", "name": "Settings object", "field": "payload", "fieldType": "msg", "format": "json", "syntax": "mustache", "template": "{\n \"helloWord\": \"Здравствуйте, вас приветствует навык внутри дома!\",\n \"intruderText\": \"Что-то не похож ты на моего хозяина. А ну-ка вон отсюда!\",\n \"notFoundText\": \"Устройство не найдено!\",\n \"userId\": \"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\",\n \"turnOnText\": \"Включаю\",\n \"turnOffText\": \"Выключаю\",\n \"entities\": {\n \"tableLamp\": \"ламп\",\n \"kitchenDownlight\": \"подсветк\"\n }\n}", "output": "json", "x": 600, "y": 380, "wires": [ [ "7848ec61.afb6ec" ] ] }, { "id": "dab350f1.624218", "type": "template", "z": "aa3ea19a.102458", "name": "hello word", "field": "payload", "fieldType": "msg", "format": "json", "syntax": "mustache", "template": "{\n \"response\": {\n \"text\": \"{{payload.const.helloWord}}\",\n \"end_session\": false\n },\n \"session\": {\n \"session_id\": \"{{payload.session.session_id}}\",\n \"message_id\": 4,\n \"user_id\": \"{{payload.session.user_id}}\"\n },\n \"version\": \"1.0\"\n}", "output": "json", "x": 1490, "y": 420, "wires": [ [ "710606f5.91d88" ] ] }, { "id": "3992346b.d37ee4", "type": "inject", "z": "aa3ea19a.102458", "name": "", "topic": "", "payload": "", "payloadType": "date", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "x": 440, "y": 380, "wires": [ [ "7ab7aa6c.1cb3cc" ] ] }, { "id": "7848ec61.afb6ec", "type": "function", "z": "aa3ea19a.102458", "name": "Settings set", "func": "flow.set(\"AliceSettings\", msg.payload)", "outputs": 1, "noerr": 0, "x": 770, "y": 380, "wires": [ [] ] }, { "id": "b379ff32.9d3ca8", "type": "function", "z": "aa3ea19a.102458", "name": "Settings const", "func": "msg.payload.const = flow.get(\"AliceSettings\")\nreturn msg", "outputs": 1, "noerr": 0, "x": 620, "y": 520, "wires": [ [ "38ed2048.87a69", "fa7d4a0c.e88ce" ] ] }, { "id": "d2beaa2c.029cd", "type": "comment", "z": "aa3ea19a.102458", "name": "Задаем наши статичные параметры (не забываем после изменения нажимать на синюю кнопку timestamp)", "info": "", "x": 620, "y": 340, "wires": [] }, { "id": "a4a77115.ad3c9", "type": "server", "z": "", "name": "Home Assistant", "legacy": false, "hassio": false, "rejectUnauthorizedCerts": false, "ha_boolean": "y|yes|true|on|home|open" } ]