diff --git a/node-red-example-flow.json b/node-red-example-flow.json index 2c95505a..9ffa15c4 100644 --- a/node-red-example-flow.json +++ b/node-red-example-flow.json @@ -1,37 +1,37 @@ [ { - "id": "ba6c8bb20b9aa4cc", + "id": "1095d804ba7660cf", "type": "tab", - "label": "NSP_Kueche", + "label": "nspanel", "disabled": false, "info": "", "env": [] }, { - "id": "df42e19d07582858", + "id": "ce92ba2dd30d18b5", "type": "mqtt in", - "z": "ba6c8bb20b9aa4cc", + "z": "1095d804ba7660cf", "name": "", - "topic": "tele/tasmota_nspkueche/RESULT", + "topic": "tele/tasmota_NsPanelTerrasse/RESULT", "qos": "2", - "datatype": "auto", + "datatype": "utf8", "broker": "aeedd16f1f009dd0", "nl": false, "rap": true, "rh": 0, "inputs": 0, "x": 190, - "y": 80, + "y": 120, "wires": [ [ - "a44b586b7fd6c26d" + "e91144d67ea326b2" ] ] }, { - "id": "f1c977fd5eacc769", + "id": "90dd992b9c45dace", "type": "debug", - "z": "ba6c8bb20b9aa4cc", + "z": "1095d804ba7660cf", "name": "", "active": true, "tosidebar": true, @@ -42,13 +42,13 @@ "statusVal": "", "statusType": "auto", "x": 990, - "y": 80, + "y": 120, "wires": [] }, { - "id": "a44b586b7fd6c26d", + "id": "e91144d67ea326b2", "type": "function", - "z": "ba6c8bb20b9aa4cc", + "z": "1095d804ba7660cf", "name": "check for CustomRecv", "func": "if(msg.payload.startsWith('\\{\"CustomRecv\":')){\n obj = JSON.parse(msg.payload)\n msg.payload = obj.CustomRecv\n return msg;\n}", "outputs": 1, @@ -57,18 +57,18 @@ "finalize": "", "libs": [], "x": 460, - "y": 80, + "y": 120, "wires": [ [ - "f1c977fd5eacc769", - "86dcef64cf01cad1" + "90dd992b9c45dace", + "e0a3b3c8887ff55f" ] ] }, { - "id": "86dcef64cf01cad1", + "id": "e0a3b3c8887ff55f", "type": "function", - "z": "ba6c8bb20b9aa4cc", + "z": "1095d804ba7660cf", "name": "pages", "func": "var pages = flow.get(\"ns-config\")\n\nfunction genEntitiesPage(pageNum){\n var out_msgs = [ {payload:\"pageType,cardEntities\"}, { payload: \"entityUpdHeading,\"+pages[pageNum].heading } ]\n\n pages[pageNum].items.forEach(function (id, i) {\n \n var type = \"delete\"\n var iconId = 0\n var name = global.get(\"homeassistant.homeAssistant.states['\"+id+\"'].attributes.friendly_name\")\n \n switch (id.substring(0,id.indexOf('.'))) {\n case \"cover\":\n type = \"shutter\"\n iconId = 0\n out_msgs.push({ payload: \"entityUpd,\"+(i+1)+\",\"+iconId+\",\"+name+\",\"+type})\n break\n case \"light\":\n type = \"light\"\n iconId = 1\n var optVal = \"0\"\n if(global.get(\"homeassistant.homeAssistant.states['\"+id+\"'].state\") == \"on\")\n optVal = \"1\"\n out_msgs.push({ payload: \"entityUpd,\"+(i+1)+\",\"+iconId+\",\"+name+\",\"+type+\",\"+optVal})\n break\n case \"sensor\":\n type = \"text\"\n if(global.get(\"homeassistant.homeAssistant.states['\"+id+\"'].attributes.device_class\") == \"temperature\"){\n iconId = 2\n }\n var optVal = global.get(\"homeassistant.homeAssistant.states['\"+id+\"'].state\") + \" \" + global.get(\"homeassistant.homeAssistant.states['\"+id+\"'].attributes.unit_of_measurement\")\n out_msgs.push({ payload: \"entityUpd,\"+(i+1)+\",\"+iconId+\",\"+name+\",\"+type+\",\"+optVal})\n break\n case \"button\":\n type = \"button\"\n iconId = 3\n var optVal = \"PRESS\"\n out_msgs.push({ payload: \"entityUpd,\"+(i+1)+\",\"+iconId+\",\"+name+\",\"+type+\",\"+optVal})\n break\n case \"delete\":\n type = \"delete\"\n out_msgs.push({ payload: \"entityUpd,\"+(i+1)+\",0,dc,\"+type})\n break\n default:\n break\n }\n\n })\n\n\n \n return out_msgs\n \n}\n\nfunction genThermoPage(pageNum){\n id = pages[pageNum].item\n var out_msgs = [ {payload:\"pageType,cardThermo\"} ]\n \n let heading = global.get(\"homeassistant.homeAssistant.states['\"+id+\"'].attributes.friendly_name\")\n let currentTemp = global.get(\"homeassistant.homeAssistant.states['\"+id+\"'].attributes.current_temperature\")*10\n let destTemp = global.get(\"homeassistant.homeAssistant.states['\"+id+\"'].attributes.temperature\")*10\n let status = global.get(\"homeassistant.homeAssistant.states['\"+id+\"'].attributes.hvac_action\")\n let minTemp = global.get(\"homeassistant.homeAssistant.states['\"+id+\"'].attributes.min_temp\")*10\n let maxTemp = global.get(\"homeassistant.homeAssistant.states['\"+id+\"'].attributes.max_temp\")*10\n //let stepTemp = global.get(\"homeassistant.homeAssistant.states['\"+id+\"'].attributes.target_temp_step\")*10\n let stepTemp = 0.5*10\n \n out_msgs.push({ payload: \"entityUpd,\"+heading+\",\"+currentTemp+\",\"+destTemp+\",\"+status+\",\"+minTemp+\",\"+maxTemp+\",\"+stepTemp })\n \n \n return out_msgs\n}\n\n\nfunction handleButtonEvent(pageNum, words){\n var out_msgs = [ ]\n pages[pageNum].items.forEach(function (id, i) {\n var name = global.get(\"homeassistant.homeAssistant.states['\"+id+\"'].attributes.friendly_name\")\n if(words[4]==name){\n if(words[6]==\"OnOff\"){\n var domain = \"switch\"\n if(id.startsWith(\"light\"))\n domain = \"light\"\n var action = \"turn_off\"\n if(words[7]==\"1\")\n action = \"turn_on\"\n out_msgs.push( {payload: id, action: action, domain: domain})\n }\n \n if(words[6]==\"up\")\n out_msgs.push( {payload: id, action: \"open_cover\", domain: \"cover\"})\n if(words[6]==\"stop\")\n out_msgs.push( {payload: id, action: \"stop_cover\", domain: \"cover\"})\n if(words[6]==\"down\")\n out_msgs.push( {payload: id, action: \"close_cover\", domain: \"cover\"})\n \n if(words[6]==\"brightnessSlider\")\n out_msgs.push( {payload: id, action: \"turn_on\", domain: \"lightBrightness\", brightness: parseInt(words[7])})\n if(words[6]==\"colorTempSlider\")\n out_msgs.push( {payload: id, action: \"turn_on\", domain: \"lightTemperature\", temperature: parseInt(words[7])})\n \n }\n }\n \n )\n return out_msgs\n}\n\nfunction searchIdInPages(friendlyName){\n let id_ret = \"\"\n // search entity in pages\n pages.forEach(page => {\n if(\"items\" in page){\n page.items.forEach(function (id, i) {\n var name = global.get(\"homeassistant.homeAssistant.states['\"+id+\"'].attributes.friendly_name\")\n if(name == friendlyName){\n id_ret = id\n }\n })\n }\n })\n return id_ret\n}\n\nfunction scale(number, inMin, inMax, outMin, outMax) {\n return (number - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;\n}\n\nfunction genDetailPage(type, friendlyName){\n var out_msgs = [ ]\n \n let id = searchIdInPages(friendlyName)\n if(type == \"popupLight\"){\n let switchVal = \"0\"\n if(global.get(\"homeassistant.homeAssistant.states['\"+id+\"'].state\") == \"on\")\n switchVal = \"1\"\n \n let attr = global.get(\"homeassistant.homeAssistant.states['\"+id+\"'].attributes\")\n \n let brightness = Math.trunc(scale(attr.brightness, 0, 255, 0, 100))\n \n let colortemp = Math.trunc(scale(attr.color_temp, attr.min_mireds, attr.max_mireds, 0, 100))\n \n out_msgs.push({ payload: \"entityUpdateDetail,\"+switchVal+\",\"+brightness+\",\"+colortemp})\n }\n\n\n \n return out_msgs\n \n}\n\n\nwords = msg.payload.split(',')\nif(words[0]=='event'){\n var pageNum = parseInt(words[2])\n pageNum = (pageNum % pages.length)\n pageNum = Math.abs(pageNum)\n flow.set(\"ns-currentPage\", pageNum)\n \n if(words[1]=='pageOpen'){\n var retMsgs = []\n \n if(pages[pageNum].type == \"cardEntities\"){\n retMsgs = genEntitiesPage(pageNum)\n }else if(pages[pageNum].type == \"cardThermo\")\n {\n retMsgs = genThermoPage(pageNum)\n }\n \n return [retMsgs, null]\n }\n if(words[1]=='buttonPress'){\n return [null, handleButtonEvent(pageNum, words)]\n }\n if(words[1]=='pageOpenDetail'){\n return [genDetailPage(words[2], words[3]), null]\n }\n \n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "outputs": 2, @@ -77,25 +77,25 @@ "finalize": "", "libs": [], "x": 770, - "y": 120, + "y": 160, "wires": [ [ - "f1c977fd5eacc769", - "1c40e3fbed77566a" + "90dd992b9c45dace", + "a9571b3ad08027d6" ], [ - "bea462f25c2d6594", - "bb5a45a85294d141" + "d365471c93b90620", + "3bc7b6a09e86cf1f" ] ] }, { - "id": "23673f9ed21f9314", + "id": "cb442d0ff23ccd50", "type": "server-state-changed", - "z": "ba6c8bb20b9aa4cc", + "z": "1095d804ba7660cf", "name": "", "server": "7b975ed1.2c58d", - "version": 3, + "version": 4, "exposeToHomeAssistant": false, "haConfig": [ { @@ -145,17 +145,17 @@ } ], "x": 200, - "y": 300, + "y": 340, "wires": [ [ - "056cb9e82f6134a5" + "a267036facc87a9c" ] ] }, { - "id": "bea462f25c2d6594", + "id": "d365471c93b90620", "type": "debug", - "z": "ba6c8bb20b9aa4cc", + "z": "1095d804ba7660cf", "name": "", "active": true, "tosidebar": true, @@ -166,36 +166,42 @@ "statusVal": "", "statusType": "auto", "x": 990, - "y": 200, + "y": 240, "wires": [] }, { - "id": "d89d65da2c861934", + "id": "76f2b49f12c59fd2", "type": "api-call-service", - "z": "ba6c8bb20b9aa4cc", + "z": "1095d804ba7660cf", "name": "", "server": "7b975ed1.2c58d", - "version": 3, + "version": 4, "debugenabled": false, - "service_domain": "light", + "domain": "light", "service": "{{action}}", - "entityId": "{{payload}}", + "target": { + "entityId": [ + "{{payload}}" + ], + "areaId": [], + "deviceId": [] + }, "data": "", "dataType": "jsonata", - "mergecontext": "", + "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "x": 1210, - "y": 200, + "y": 240, "wires": [ [] ] }, { - "id": "bb5a45a85294d141", + "id": "3bc7b6a09e86cf1f", "type": "switch", - "z": "ba6c8bb20b9aa4cc", + "z": "1095d804ba7660cf", "name": "", "property": "domain", "propertyType": "msg", @@ -230,98 +236,116 @@ "repair": false, "outputs": 5, "x": 990, - "y": 260, + "y": 300, "wires": [ [ - "d89d65da2c861934" + "76f2b49f12c59fd2" ], [ - "1ddde5e25ac783b8" + "439c4edaa91cfd46" ], [ - "1207b113e1e44be4" + "8b9fd15277f38896" ], [ - "f494954196883dd7" + "d67a45b07be3f0e2" ], [ - "0cea8c43c493c215" + "948f928f2606a5c7" ] ] }, { - "id": "f494954196883dd7", + "id": "d67a45b07be3f0e2", "type": "api-call-service", - "z": "ba6c8bb20b9aa4cc", + "z": "1095d804ba7660cf", "name": "", "server": "7b975ed1.2c58d", - "version": 3, + "version": 4, "debugenabled": false, - "service_domain": "switch", + "domain": "switch", "service": "{{action}}", - "entityId": "{{payload}}", + "target": { + "entityId": [ + "{{payload}}" + ], + "areaId": [], + "deviceId": [] + }, "data": "", "dataType": "jsonata", - "mergecontext": "", + "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "x": 1220, - "y": 360, + "y": 400, "wires": [ [] ] }, { - "id": "0cea8c43c493c215", + "id": "948f928f2606a5c7", "type": "api-call-service", - "z": "ba6c8bb20b9aa4cc", + "z": "1095d804ba7660cf", "name": "", "server": "7b975ed1.2c58d", - "version": 3, + "version": 4, "debugenabled": false, - "service_domain": "cover", + "domain": "cover", "service": "{{action}}", - "entityId": "{{payload}}", + "target": { + "entityId": [ + "{{payload}}" + ], + "areaId": [], + "deviceId": [] + }, "data": "", "dataType": "jsonata", - "mergecontext": "", + "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "x": 1210, - "y": 420, + "y": 460, "wires": [ [] ] }, { - "id": "1ddde5e25ac783b8", + "id": "439c4edaa91cfd46", "type": "api-call-service", - "z": "ba6c8bb20b9aa4cc", + "z": "1095d804ba7660cf", "name": "lightBrightness", "server": "7b975ed1.2c58d", - "version": 3, + "version": 4, "debugenabled": false, - "service_domain": "light", + "domain": "light", "service": "turn_on", - "entityId": "{{payload}}", + "target": { + "entityId": [ + "{{payload}}" + ], + "areaId": [], + "deviceId": [] + }, "data": "{\"brightness_pct\":{{brightness}}}", "dataType": "json", - "mergecontext": "", + "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "x": 1200, - "y": 240, + "y": 280, "wires": [ [] ] }, { - "id": "1207b113e1e44be4", + "id": "8b9fd15277f38896", "type": "function", - "z": "ba6c8bb20b9aa4cc", + "z": "1095d804ba7660cf", "name": "calcMireds", "func": "function scale(number, inMin, inMax, outMin, outMax) {\n return (number - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;\n}\n\nvar id = msg.payload\nvar attr = global.get(\"homeassistant.homeAssistant.states['\"+id+\"'].attributes\")\n\nvar mireds = scale(msg.temperature, 0, 100, attr.min_mireds, attr.max_mireds)\n\nmsg.temperature = mireds\nreturn msg\n\n", "outputs": 1, @@ -330,140 +354,63 @@ "finalize": "", "libs": [], "x": 1190, - "y": 300, + "y": 340, "wires": [ [ - "8f0f6a771251ef17" + "c45664b5317f7a0f" ] ] }, { - "id": "8f0f6a771251ef17", + "id": "c45664b5317f7a0f", "type": "api-call-service", - "z": "ba6c8bb20b9aa4cc", + "z": "1095d804ba7660cf", "name": "lightTemperature", "server": "7b975ed1.2c58d", - "version": 3, + "version": 4, "debugenabled": false, - "service_domain": "light", + "domain": "light", "service": "turn_on", - "entityId": "{{payload}}", + "target": { + "entityId": [ + "{{payload}}" + ], + "areaId": [], + "deviceId": [] + }, "data": "{\"color_temp\":{{temperature}}}", "dataType": "json", - "mergecontext": "", + "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "x": 1370, - "y": 300, + "y": 340, "wires": [ [] ] }, { - "id": "b968e02c88f3500d", + "id": "275db83c5edd2c9b", "type": "function", - "z": "ba6c8bb20b9aa4cc", - "name": "pages", - "func": "msg.payload = global.get(\"homeassistant.homeAssistant.states['sensor.kleiderschrank1_si7021_temperature']\")\nreturn msg", - "outputs": 1, - "noerr": 0, - "initialize": "", - "finalize": "", - "libs": [], - "x": 790, - "y": 580, - "wires": [ - [ - "b51a0f5849d2a1a0" - ] - ] - }, - { - "id": "1f1d39ecab559597", - "type": "inject", - "z": "ba6c8bb20b9aa4cc", - "name": "", - "props": [ - { - "p": "payload" - }, - { - "p": "topic", - "vt": "str" - } - ], - "repeat": "", - "crontab": "", - "once": false, - "onceDelay": 0.1, - "topic": "", - "payload": "", - "payloadType": "date", - "x": 640, - "y": 580, - "wires": [ - [ - "b968e02c88f3500d" - ] - ] - }, - { - "id": "b51a0f5849d2a1a0", - "type": "debug", - "z": "ba6c8bb20b9aa4cc", - "name": "", - "active": true, - "tosidebar": true, - "console": false, - "tostatus": false, - "complete": "true", - "targetType": "full", - "statusVal": "", - "statusType": "auto", - "x": 950, - "y": 580, - "wires": [] - }, - { - "id": "1c40e3fbed77566a", - "type": "mqtt out", - "z": "ba6c8bb20b9aa4cc", - "name": "", - "topic": "cmnd/tasmota_nspkueche/CustomSend", - "qos": "", - "retain": "", - "respTopic": "", - "contentType": "", - "userProps": "", - "correl": "", - "expiry": "", - "broker": "aeedd16f1f009dd0", - "x": 1080, - "y": 120, - "wires": [] - }, - { - "id": "06345c11ce5d62fe", - "type": "function", - "z": "ba6c8bb20b9aa4cc", + "z": "1095d804ba7660cf", "name": "config", "func": "//see start tab", "outputs": 1, "noerr": 0, - "initialize": "if (flow.get(\"ns-config\") === undefined) {\n \n var pages = \n [\n {\n type: \"cardEntities\",\n heading: \"TestPage\",\n items: [\"light.kueche_lights\", \"sensor.nsp_kueche_analog_temperature1\", \"delete\", \"delete\"] \n },\n {\n type: \"cardThermo\",\n item: \"climate.kuche_boden\"\n }\n ]\n\n\n flow.set(\"ns-config\", pages)\n}", + "initialize": "//if (flow.get(\"ns-config\") === undefined) {\n \nvar pages = \n[\n { \n type: \"cardEntities\",\n heading: \"Rolladen\",\n items: [\"cover.rolladenfenster_cover_1\", \"cover.nspterrasse_cover_1\", \"cover.rolladenterasse_cover_1\", \"sensor.nspterrasse_analog_temperature1\"] \n },\n {\n type: \"cardEntities\",\n heading: \"TestPage\",\n items: [\"button.beamer_key_left\", \"cover.rolladenterasse_cover_1\", \"light.schreibtischlampe\", \"sensor.kleiderschrank1_si7021_temperature\"] \n }\n]\n\n\n flow.set(\"ns-config\", pages)\n//}", "finalize": "", "libs": [], "x": 1390, - "y": 60, + "y": 100, "wires": [ [] ] }, { - "id": "cac2f4129b2e5a4f", + "id": "ab0817adc78e3c5b", "type": "inject", - "z": "ba6c8bb20b9aa4cc", + "z": "1095d804ba7660cf", "name": "", "props": [ { @@ -482,17 +429,17 @@ "payload": "event,pageOpen,0", "payloadType": "str", "x": 430, - "y": 360, + "y": 400, "wires": [ [ - "86dcef64cf01cad1" + "e0a3b3c8887ff55f" ] ] }, { - "id": "056cb9e82f6134a5", + "id": "a267036facc87a9c", "type": "function", - "z": "ba6c8bb20b9aa4cc", + "z": "1095d804ba7660cf", "name": "externalUpdates", "func": "let currentPageNr = flow.get(\"ns-currentPage\")\n\nlet currentPageConfig = flow.get(\"ns-config\")[currentPageNr]\n\nif(\"items\" in currentPageConfig){\n if(msg.topic in currentPageConfig.items){\n \n }\n}\n\n", "outputs": 1, @@ -501,99 +448,33 @@ "finalize": "", "libs": [], "x": 460, - "y": 300, + "y": 340, "wires": [ [] ] }, { - "id": "946aaade2d1f150a", - "type": "server-state-changed", - "z": "ba6c8bb20b9aa4cc", + "id": "a9571b3ad08027d6", + "type": "mqtt out", + "z": "1095d804ba7660cf", "name": "", - "server": "7b975ed1.2c58d", - "version": 3, - "exposeToHomeAssistant": false, - "haConfig": [ - { - "property": "name", - "value": "" - }, - { - "property": "icon", - "value": "" - } - ], - "entityidfilter": "light.kueche_lights", - "entityidfiltertype": "exact", - "outputinitially": false, - "state_type": "str", - "haltifstate": "on", - "halt_if_type": "str", - "halt_if_compare": "is", - "outputs": 2, - "output_only_on_state_change": 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": 760, - "y": 440, - "wires": [ - [ - "962b6a55abf0113e" - ], - [] - ] + "topic": "cmnd/tasmota_NsPanelTerrasse/CustomSend", + "qos": "", + "retain": "", + "respTopic": "", + "contentType": "", + "userProps": "", + "correl": "", + "expiry": "", + "broker": "aeedd16f1f009dd0", + "x": 1100, + "y": 160, + "wires": [] }, { - "id": "962b6a55abf0113e", - "type": "function", - "z": "ba6c8bb20b9aa4cc", - "name": "wake&display", - "func": "var out_msgs = \n[ {payload:\"wake\"}, \n {payload: \"pageType,popupLight,Kueche\"} \n]\n\n\n\nreturn [out_msgs]", - "outputs": 1, - "noerr": 0, - "initialize": "if (flow.get(\"ns-currentPage\") === undefined) {\n flow.set(\"ns-currentPage\", 0)\n}", - "finalize": "", - "libs": [], - "x": 800, - "y": 380, - "wires": [ - [ - "1c40e3fbed77566a", - "f1c977fd5eacc769" - ] - ] - }, - { - "id": "f3a47d87b237c392", + "id": "8638719b967711fa", "type": "inject", - "z": "ba6c8bb20b9aa4cc", + "z": "1095d804ba7660cf", "name": "", "props": [ { @@ -605,17 +486,234 @@ } ], "repeat": "", - "crontab": "", + "crontab": "00 12 * * *", "once": false, "onceDelay": 0.1, "topic": "", - "payload": "pageType,popupLight,Kueche", - "payloadType": "str", - "x": 730, - "y": 340, + "payload": "", + "payloadType": "date", + "x": 310, + "y": 600, "wires": [ [ - "1c40e3fbed77566a" + "d56371833aa274cc" + ] + ] + }, + { + "id": "7288ca775329100e", + "type": "debug", + "z": "1095d804ba7660cf", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "statusVal": "", + "statusType": "auto", + "x": 670, + "y": 600, + "wires": [] + }, + { + "id": "d56371833aa274cc", + "type": "function", + "z": "1095d804ba7660cf", + "name": "time string", + "func": "var today = new Date();\n\nlet hours = today.getHours()\nlet mins = today.getMinutes()\n\nif (hours < 10) {\n hours = \"0\" + hours;\n}\nif (mins < 10) {\n mins = \"0\" + mins;\n}\n\n\nvar time = hours + \" : \" + mins;\nmsg.payload = \"time,\"+time;\nreturn msg;", + "outputs": 1, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 510, + "y": 600, + "wires": [ + [ + "7288ca775329100e", + "a9571b3ad08027d6" + ] + ] + }, + { + "id": "bfd12f4e368fe345", + "type": "inject", + "z": "1095d804ba7660cf", + "name": "", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "00 23 * * *", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "dimmode,0", + "payloadType": "str", + "x": 750, + "y": 540, + "wires": [ + [ + "a9571b3ad08027d6" + ] + ] + }, + { + "id": "07fd340861321ee3", + "type": "inject", + "z": "1095d804ba7660cf", + "name": "", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "00 07 * * *", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "dimmode,1", + "payloadType": "str", + "x": 750, + "y": 420, + "wires": [ + [ + "a9571b3ad08027d6" + ] + ] + }, + { + "id": "9b76fcd1a10e74b1", + "type": "inject", + "z": "1095d804ba7660cf", + "name": "", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "00 09 * * *", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "dimmode,10", + "payloadType": "str", + "x": 760, + "y": 460, + "wires": [ + [ + "a9571b3ad08027d6" + ] + ] + }, + { + "id": "4f31d122bf51281e", + "type": "inject", + "z": "1095d804ba7660cf", + "name": "", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "00 19 * * *", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "dimmode,1", + "payloadType": "str", + "x": 750, + "y": 500, + "wires": [ + [ + "a9571b3ad08027d6" + ] + ] + }, + { + "id": "243b5fd457f41904", + "type": "inject", + "z": "1095d804ba7660cf", + "name": "", + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "00 00 * * *", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "", + "payloadType": "date", + "x": 310, + "y": 640, + "wires": [ + [ + "e0eb13c55bb592c9" + ] + ] + }, + { + "id": "e038718f48e4b5b4", + "type": "debug", + "z": "1095d804ba7660cf", + "name": "", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "false", + "statusVal": "", + "statusType": "auto", + "x": 670, + "y": 640, + "wires": [] + }, + { + "id": "e0eb13c55bb592c9", + "type": "function", + "z": "1095d804ba7660cf", + "name": "date string", + "func": "var today = new Date();\n\nlet day = today.getDay()\nlet month = today.getMonth()\n\nconst options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };\n\nvar date = today.toLocaleDateString('de-DE', options);\n\nmsg.payload = \"date,?\"+date;\nreturn msg;", + "outputs": 1, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 510, + "y": 640, + "wires": [ + [ + "e038718f48e4b5b4", + "a9571b3ad08027d6" ] ] }, @@ -658,4 +756,4 @@ "heartbeat": false, "heartbeatInterval": "30" } -] \ No newline at end of file +]