Node to Check outside temperature and raise thermostat + 1 degree

hello, someone can say me what’s wrong on this flow?

nothing change or happens but I think there are not error.

[{
    "id": "8031d4c08266bb88",
    "type": "debug",
    "z": "5b13fa0d2adc43fb",
    "g": "47e6d5ab36e71d67",
    "name": "debug 2",
    "active": true,
    "tosidebar": true,
    "console": false,
    "tostatus": false,
    "complete": "true",
    "targetType": "full",
    "statusVal": "",
    "statusType": "auto",
    "x": 1370,
    "y": 1000,
    "wires": []
  },
  {
    "id": "e12f27c8fa40d349",
    "type": "api-call-service",
    "z": "5b13fa0d2adc43fb",
    "g": "47e6d5ab36e71d67",
    "name": "Imposta nuova temperatura",
    "server": "3fa08516.1d473a",
    "version": 7,
    "debugenabled": false,
    "action": "climate.set_temperature",
    "floorId": [],
    "areaId": [],
    "deviceId": [],
    "entityId": [],
    "labelId": [],
    "data": "{\n    \"entity_id\": \"{{entity_id}}\",\n    \"temperature\": \"{{temperature}}\"\n}\n",
    "dataType": "jsonata",
    "mergeContext": "false",
    "mustacheAltTags": false,
    "outputProperties": [],
    "blockInputOverrides": false,
    "domain": "climate",
    "service": "set_temperature",
    "output_location": "",
    "output_location_type": "none",
    "x": 1270,
    "y": 940,
    "wires": [
      ["8031d4c08266bb88"]
    ]
  },
  {
    "id": "c8afbc1adc9e631d",
    "type": "function",
    "z": "5b13fa0d2adc43fb",
    "g": "47e6d5ab36e71d67",
    "name": "Aumenta temperatura termostati",
    "func": "if (msg.thermostat_entity_ids) {\n    msg.thermostat_entity_ids.forEach(thermostat => {\n        node.send({\n            payload: {\n                domain: 'climate',\n                service: 'set_temperature',\n                data: {\n                    entity_id: thermostat,\n                    temperature: 1 // Aumenta di 1°C\n                }\n            }\n        });\n    });\n}\nreturn null;\n",
    "outputs": 1,
    "timeout": "",
    "noerr": 0,
    "initialize": "",
    "finalize": "",
    "libs": [],
    "x": 1000,
    "y": 940,
    "wires": [
      ["e12f27c8fa40d349"]
    ]
  },
  {
    "id": "cbcc1c7d6df6bb70",
    "type": "function",
    "z": "5b13fa0d2adc43fb",
    "g": "47e6d5ab36e71d67",
    "name": "Verifica temperatura esterna",
    "func": "if (msg.payload > 0) {\n    // Aggiungi gli ID dei termostati da controllare\n    msg.thermostat_entity_ids = [\n        'climate.shellywalldisplay_000822fd344f_thermostat_0',\n        'climate.shellywalldisplay_000822835122_thermostat_0'\n    ];\n    return msg;\n} else {\n    return null; // Interrompe il flusso se la temperatura esterna è <= 0°C\n}\n",
    "outputs": 1,
    "timeout": "",
    "noerr": 0,
    "initialize": "",
    "finalize": "",
    "libs": [],
    "x": 710,
    "y": 940,
    "wires": [
      ["c8afbc1adc9e631d"]
    ]
  },
  {
    "id": "e0066da28ca527c6",
    "type": "api-current-state",
    "z": "5b13fa0d2adc43fb",
    "g": "47e6d5ab36e71d67",
    "name": "Stato attuale weather.forecast_mokaor",
    "server": "3fa08516.1d473a",
    "version": 3,
    "outputs": 1,
    "halt_if": "",
    "halt_if_type": "str",
    "halt_if_compare": "is",
    "entity_id": "weather.forecast_mokaor",
    "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",
    "x": 410,
    "y": 940,
    "wires": [
      ["cbcc1c7d6df6bb70"]
    ]
  },
  {
    "id": "f7b61878f8ba5803",
    "type": "inject",
    "z": "5b13fa0d2adc43fb",
    "g": "47e6d5ab36e71d67",
    "name": "Attivazione manuale",
    "props": [],
    "repeat": "",
    "crontab": "",
    "once": false,
    "onceDelay": 0.1,
    "topic": "",
    "x": 160,
    "y": 940,
    "wires": [
      ["e0066da28ca527c6"]
    ]
  },
  {
    "id": "3fa08516.1d473a",
    "type": "server",
    "name": "Home Assistant",
    "addon": true
  }
]

A more straight forward approach to address 2 thermostats is to define them in the node itself. This will set the temp on both. Whatever value that is in msg.payload will be the temp the thermostats are set to.

[{"id":"e12f27c8fa40d349","type":"api-call-service","z":"0a325c35fc29f44e","name":"Imposta nuova temperatura","server":"6b1110b5.183a4","version":7,"debugenabled":false,"action":"climate.set_temperature","floorId":[],"areaId":[],"deviceId":[],"entityId":["climate.shellywalldisplay_000822fd344f_thermostat_0","climate.shellywalldisplay_000822835122_thermostat_0"],"labelId":[],"data":"{\t    \"temperature\": payload\t}","dataType":"jsonata","mergeContext":"false","mustacheAltTags":false,"outputProperties":[],"blockInputOverrides":true,"domain":"climate","service":"set_temperature","output_location":"","output_location_type":"none","x":960,"y":5860,"wires":[["8031d4c08266bb88"]]},{"id":"6b1110b5.183a4","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"id","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]

thanks for reply and kind try help me. I have to modify also other parts?

[{"id":"e12f27c8fa40d349","type":"api-call-service","z":"0a325c35fc29f44e","name":"Imposta nuova temperatura","server":"6b1110b5.183a4","version":7,"debugenabled":false,"action":"climate.set_temperature","floorId":[],"areaId":[],"deviceId":[],"entityId":["climate.shellywalldisplay_000822fd344f_thermostat_0","climate.shellywalldisplay_000822835122_thermostat_0"],"labelId":[],"data":"{\t    \"temperature\": payload\t}","dataType":"jsonata","mergeContext":"false","mustacheAltTags":false,"outputProperties":[],"blockInputOverrides":true,"domain":"climate","service":"set_temperature","output_location":"","output_location_type":"none","x":960,"y":5860,"wires":[["8031d4c08266bb88"]]},{"id":"6b1110b5.183a4","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"id","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]

I remember that I want to check outdoor temp and if it is in some condition raise up thermostat +1 degree

I solved with this…

[{"id":"47f8e61d58b9acc3","type":"api-call-service","z":"5b13fa0d2adc43fb","name":"Imposta nuova temperatura","server":"6b1110b5.183a4","version":7,"debugenabled":false,"action":"climate.set_temperature","floorId":[],"areaId":[],"deviceId":["34233afed3966c82c151791d2fed3235"],"entityId":[],"labelId":[],"data":"{\"temperature\": \"{{payload.temperature}}\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","blockInputOverrides":false,"domain":"climate","service":"set_temperature","target":{"entity_id":"{{entity_id}}"},"x":1600,"y":1440,"wires":[[]]},{"id":"c202dbac918f9580","type":"function","z":"5b13fa0d2adc43fb","name":"Calcola Nuova T° Contabilità","func":"const raiseTemp = parseFloat(msg.raiseTemp) || 0; // Converti raiseTemp in float\nconst currentTemp = parseFloat(msg.current_temp_2) || 0; // Converti current_temp_2 in float\nmsg.payload = {\n    temperature: currentTemp + raiseTemp\n};\nmsg.entity_id = \"climate.shellywalldisplay_000822835122_thermostat_0\";\nreturn msg;\n","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":1300,"y":1440,"wires":[["47f8e61d58b9acc3"]]},{"id":"7438a4753067f88c","type":"change","z":"5b13fa0d2adc43fb","name":"Estrai temperatura","rules":[{"t":"set","p":"current_temp_2","pt":"msg","to":"data.attributes.temperature","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":1440,"wires":[["c202dbac918f9580"]]},{"id":"7b81b1b47108aed8","type":"api-current-state","z":"5b13fa0d2adc43fb","name":"T° Attuale Contabilità","server":"6b1110b5.183a4","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"climate.shellywalldisplay_000822835122_thermostat_0","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"","forType":"num","x":820,"y":1440,"wires":[["7438a4753067f88c"]]},{"id":"a84b5a6c110389ca","type":"switch","z":"5b13fa0d2adc43fb","name":"T° Esterna > 0?","property":"temperature_outdoor","propertyType":"msg","rules":[{"t":"gt","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":620,"y":1400,"wires":[["9fda2d15e5fcf29e","7b81b1b47108aed8"]]},{"id":"8d8bf92037d40821","type":"change","z":"5b13fa0d2adc43fb","name":"Estrai temperatura","rules":[{"t":"set","p":"temperature_outdoor","pt":"msg","to":"data.attributes.temperature","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":1400,"wires":[["a84b5a6c110389ca"]]},{"id":"9fda2d15e5fcf29e","type":"api-current-state","z":"5b13fa0d2adc43fb","name":"T° Attuale Ufficio","server":"6b1110b5.183a4","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"climate.shellywalldisplay_000822fd344f_thermostat_0","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"","forType":"num","x":830,"y":1360,"wires":[["c9df1ebab81921fe"]]},{"id":"a48a5ccd6d691039","type":"api-current-state","z":"5b13fa0d2adc43fb","name":"Temperatura esterna","server":"6b1110b5.183a4","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"weather.forecast_mokaor","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"","forType":"num","x":220,"y":1400,"wires":[["8d8bf92037d40821"]]},{"id":"c9df1ebab81921fe","type":"change","z":"5b13fa0d2adc43fb","name":"Estrai temperatura","rules":[{"t":"set","p":"current_temp_1","pt":"msg","to":"data.attributes.temperature","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":1360,"wires":[["b9ee1d79c5d81458"]]},{"id":"eda5a7df6048a966","type":"inject","z":"5b13fa0d2adc43fb","name":"Imposta Raise_Temp","props":[{"p":"raiseTemp","v":"1","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","x":140,"y":1480,"wires":[["a48a5ccd6d691039"]]},{"id":"b9ee1d79c5d81458","type":"function","z":"5b13fa0d2adc43fb","name":"Calcola nuova T° Ufficio","func":"const raiseTemp = parseFloat(msg.raiseTemp) || 0; // Converti raiseTemp in float\nconst currentTemp = parseFloat(msg.current_temp_1) || 0; // Converti current_temp_1 in float\nmsg.payload = {\n    temperature: currentTemp + raiseTemp\n};\nmsg.entity_id = \"climate.shellywalldisplay_000822fd344f_thermostat_0\";\nreturn msg;\n","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":1290,"y":1360,"wires":[["0ece66b5b0580938"]]},{"id":"0ece66b5b0580938","type":"api-call-service","z":"5b13fa0d2adc43fb","name":"Imposta nuova temperatura","server":"6b1110b5.183a4","version":7,"debugenabled":false,"action":"climate.set_temperature","floorId":[],"areaId":[],"deviceId":["5fc13a90beca6a0ef2638f3bb628362d"],"entityId":[],"labelId":[],"data":"{\"temperature\": \"{{payload.temperature}}\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","blockInputOverrides":false,"domain":"climate","service":"set_temperature","target":{"entity_id":"{{entity_id}}"},"x":1580,"y":1360,"wires":[[]]},{"id":"6b1110b5.183a4","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"id","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]
1 Like