Hello all, I’m new to NodeRed an trying to wrap my head around it for some days.
My goal is to turn on and off a heating mat so the temperature of my seedlings stays between 25 - 28°C between 08:00 - 18:00 hours.
At the moment my flow looks like this:
corresponding code:
[
{
"id": "81a4b5c6169b14e8",
"type": "tab",
"label": "Heizmatte Pflanzen",
"disabled": false,
"info": "Heizmatte Pflanzen an / ausschalten via \r\nBadezimmer Thermometer und \r\nShellyPlug-4-Universell",
"env": []
},
{
"id": "81ae0094a1622946",
"type": "server-state-changed",
"z": "81a4b5c6169b14e8",
"name": "HT<26C_5min",
"server": "9952a067.8c83d",
"version": 4,
"exposeToHomeAssistant": false,
"haConfig": [
{
"property": "name",
"value": ""
},
{
"property": "icon",
"value": ""
}
],
"entityidfilter": "sensor.ble_temperature_humtemp5",
"entityidfiltertype": "exact",
"outputinitially": true,
"state_type": "num",
"haltifstate": "26",
"halt_if_type": "num",
"halt_if_compare": "lt",
"outputs": 2,
"output_only_on_state_change": false,
"for": "5",
"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": 80,
"y": 60,
"wires": [
[
"1e7d2eebaa9d67a1",
"3dc47d4b70261d61"
],
[
"9055c44074744c9c",
"e0814726124c4524"
]
]
},
{
"id": "0becb75158277a92",
"type": "api-call-service",
"z": "81a4b5c6169b14e8",
"name": "Heizmatte_Ausschalten",
"server": "9952a067.8c83d",
"version": 5,
"debugenabled": false,
"domain": "switch",
"service": "turn_off",
"areaId": [],
"deviceId": [
"5b9538c56aed01de63d4a21964248abd"
],
"entityId": [],
"data": "",
"dataType": "jsonata",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 590,
"y": 140,
"wires": [
[]
]
},
{
"id": "001930a28869adca",
"type": "api-call-service",
"z": "81a4b5c6169b14e8",
"name": "Heizmatte_Anschalten",
"server": "9952a067.8c83d",
"version": 5,
"debugenabled": false,
"domain": "switch",
"service": "turn_on",
"areaId": [],
"deviceId": [
"5b9538c56aed01de63d4a21964248abd"
],
"entityId": [],
"data": "",
"dataType": "jsonata",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 580,
"y": 60,
"wires": [
[]
]
},
{
"id": "1e7d2eebaa9d67a1",
"type": "time-range-switch",
"z": "81a4b5c6169b14e8",
"name": "10H",
"lat": "",
"lon": "",
"startTime": "08:00",
"endTime": "18:00",
"startOffset": 0,
"endOffset": 0,
"x": 290,
"y": 60,
"wires": [
[
"001930a28869adca"
],
[
"9055c44074744c9c"
]
]
},
{
"id": "9055c44074744c9c",
"type": "api-current-state",
"z": "81a4b5c6169b14e8",
"name": "An?",
"server": "9952a067.8c83d",
"version": 3,
"outputs": 2,
"halt_if": "on",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "switch.shellyplug4universell",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": "0",
"forType": "num",
"forUnits": "minutes",
"override_topic": false,
"state_location": "payload",
"override_payload": "msg",
"entity_location": "data",
"override_data": "msg",
"x": 290,
"y": 140,
"wires": [
[
"0becb75158277a92"
],
[]
]
},
{
"id": "e0814726124c4524",
"type": "debug",
"z": "81a4b5c6169b14e8",
"name": "<26_False",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 290,
"y": 240,
"wires": []
},
{
"id": "3dc47d4b70261d61",
"type": "debug",
"z": "81a4b5c6169b14e8",
"name": "<26_True",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 280,
"y": 20,
"wires": []
},
{
"id": "9952a067.8c83d",
"type": "server",
"name": "Home Assistant",
"addon": true
}
]
The problem is, this flow only works if I manually turn on the wifi plug in the morning and I’m not really sure what I’m missing here so the flow starts automatically, something like this:
If (time between 08:00 - 18:00)
{
If (temperature < 26)
{turn on heating}
if (temperature >28)
{turn off heating} #at the moment solved trough the “5min delay” in the “event: state” type
}
else
{
switch off
}
Thanks in advance for the help!