I've created a flow to control my thermostat and also to reset it after some time.
While testing I set an inject to push timestamp every 5 seconds and if the last change on the thermostat +10 seconds is reached to reset. (this is not fully finished but yet)
The issue is, after some point of running it began eating memory and CPU! and I cannot understand why.
The Flow is:
[
{
"id": "4398d66c.162748",
"type": "mqtt in",
"z": "ebd56e5.ec86b9",
"name": "TRV CurrentTemp",
"topic": "zwave2mqtt/HallwayFirst/TRV/49/1/1",
"qos": "2",
"datatype": "json",
"broker": "90876955.0f6418",
"x": 130,
"y": 80,
"wires": [
[
"1156e4a.3707d1b"
]
]
},
{
"id": "6611a45c.a42f9c",
"type": "ui_heater_controller",
"z": "ebd56e5.ec86b9",
"name": "heater",
"group": "fbed6f0b.6a621",
"unit": "C",
"order": 1,
"width": 0,
"height": 0,
"topic": "",
"title": "",
"logLengthType": "days",
"logLength": "0",
"sliderMinValue": 12,
"sliderMaxValue": 28,
"sliderStep": 0.5,
"thresholdRising": 0.5,
"thresholdFalling": 0.5,
"calendar": "{\n \"Monday\": {\n \"00:00\": 19,\n \"06:20\": 22,\n \"08:00\": 19,\n \"16:40\": 22,\n \"23:59\": 19\n },\n \"Tuesday\": {\n \"00:00\": 19,\n \"06:20\": 22,\n \"08:00\": 19,\n \"16:40\": 22,\n \"23:59\": 19\n },\n \"Wednesday\": {\n \"00:00\": 19,\n \"06:20\": 22,\n \"08:00\": 19,\n \"16:40\": 22,\n \"23:59\": 19\n },\n \"Thursday\": {\n \"00:00\": 19,\n \"06:20\": 22,\n \"08:00\": 19,\n \"16:40\": 22,\n \"23:59\": 19\n },\n \"Friday\": {\n \"00:00\": 19,\n \"06:20\": 23,\n \"08:00\": 19,\n \"16:40\": 22,\n \"23:59\": 19\n },\n \"Saturday\": {\n \"00:00\": 19,\n \"08:00\": 20,\n \"20:00\": 22,\n \"23:59\": 19\n },\n \"Sunday\": {\n \"00:00\": 19,\n \"08:00\": 20,\n \"20:00\": 22,\n \"23:59\": 19\n }\n}",
"x": 490,
"y": 80,
"wires": [
[
"a8e2dfa0.23693",
"cfed7818.3ce6a8"
]
]
},
{
"id": "1156e4a.3707d1b",
"type": "change",
"z": "ebd56e5.ec86b9",
"name": "",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "currentTemp",
"tot": "str"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.value",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 320,
"y": 80,
"wires": [
[
"6611a45c.a42f9c"
]
]
},
{
"id": "a8e2dfa0.23693",
"type": "switch",
"z": "ebd56e5.ec86b9",
"name": "",
"property": "payload.targetValue",
"propertyType": "msg",
"rules": [
{
"t": "neq",
"v": "currentSetTemp",
"vt": "flow"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 690,
"y": 160,
"wires": [
[
"4043672b.9b5ef8"
]
]
},
{
"id": "61949791.655088",
"type": "change",
"z": "ebd56e5.ec86b9",
"name": "",
"rules": [
{
"t": "set",
"p": "currentSetTemp",
"pt": "flow",
"to": "payload.value",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 490,
"y": 440,
"wires": [
[]
]
},
{
"id": "26e241e0.01f89e",
"type": "mqtt in",
"z": "ebd56e5.ec86b9",
"name": "TRV SetTemp",
"topic": "zwave2mqtt/HallwayFirst/TRV/67/1/1",
"qos": "1",
"datatype": "json",
"broker": "90876955.0f6418",
"x": 230,
"y": 440,
"wires": [
[
"61949791.655088"
]
]
},
{
"id": "4043672b.9b5ef8",
"type": "change",
"z": "ebd56e5.ec86b9",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.targetValue",
"tot": "msg"
},
{
"t": "set",
"p": "#:(disk)::changeTimestamp",
"pt": "flow",
"to": "",
"tot": "date"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 860,
"y": 160,
"wires": [
[]
]
},
{
"id": "78177e54.cd333",
"type": "inject",
"z": "ebd56e5.ec86b9",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "5",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 110,
"y": 280,
"wires": [
[
"687a69.d60d8598",
"42b35a0.9de0ea8"
]
]
},
{
"id": "cda34824.2d2678",
"type": "switch",
"z": "ebd56e5.ec86b9",
"name": "",
"property": "($flowContext(\"changeTimestamp\", \"disk\") + 10000) < payload",
"propertyType": "jsonata",
"rules": [
{
"t": "true"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 410,
"y": 280,
"wires": [
[]
]
},
{
"id": "42b35a0.9de0ea8",
"type": "debug",
"z": "ebd56e5.ec86b9",
"name": "Custom state",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "$flowContext(\"isUserCustom\", \"disk\")",
"targetType": "jsonata",
"x": 360,
"y": 360,
"wires": []
},
{
"id": "cfed7818.3ce6a8",
"type": "change",
"z": "ebd56e5.ec86b9",
"name": "",
"rules": [
{
"t": "set",
"p": "#:(disk)::isUserCustom",
"pt": "flow",
"to": "payload.isUserCustom",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 760,
"y": 80,
"wires": [
[]
]
},
{
"id": "687a69.d60d8598",
"type": "switch",
"z": "ebd56e5.ec86b9",
"name": "",
"property": "#:(disk)::isUserCustom",
"propertyType": "flow",
"rules": [
{
"t": "true"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 270,
"y": 280,
"wires": [
[
"cda34824.2d2678"
]
]
},
{
"id": "90876955.0f6418",
"type": "mqtt-broker",
"z": "",
"name": "Main MQTT",
"broker": "mqtt",
"port": "1883",
"clientid": "",
"usetls": false,
"compatmode": false,
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"willTopic": "",
"willQos": "0",
"willPayload": ""
},
{
"id": "fbed6f0b.6a621",
"type": "ui_group",
"z": "",
"name": "Heating",
"tab": "dee0def.c82102",
"order": 1,
"disp": true,
"width": "6",
"collapse": false
},
{
"id": "dee0def.c82102",
"type": "ui_tab",
"z": "",
"name": "Main",
"icon": "dashboard",
"order": 1,
"disabled": false,
"hidden": false
}
]