Cela me parait la solution la plus simple, cependant il me reste à mettre un second flux qui mettra à jour l’input_select au cas où quelqu’un change localement la valeur sur la PAC.
Voici mon flow nodered complet
[
{
"id": "2f7fb9c6403b335c",
"type": "tab",
"label": "PAC Hitachi",
"disabled": false,
"info": ""
},
{
"id": "fdd93af093a7ccf6",
"type": "modbus-write",
"z": "2f7fb9c6403b335c",
"name": "Write adress: 1007",
"showStatusActivities": false,
"showErrors": false,
"unitid": "",
"dataType": "HoldingRegister",
"adr": "1007",
"quantity": "1",
"server": "6837609d3ee526a4",
"emptyMsgOnFail": false,
"keepMsgProperties": false,
"x": 670,
"y": 100,
"wires": [
[],
[
"383623b69801446c"
]
]
},
{
"id": "11a4cc2002035738",
"type": "server-state-changed",
"z": "2f7fb9c6403b335c",
"name": "state_changed: Mode ECO/Confort",
"server": "d8cde96c5bee6be7",
"version": 3,
"exposeToHomeAssistant": false,
"haConfig": [
{
"property": "name",
"value": ""
},
{
"property": "icon",
"value": ""
}
],
"entityidfilter": "input_select.hitachi_1057_mode_eco_confort",
"entityidfiltertype": "exact",
"outputinitially": false,
"state_type": "str",
"haltifstate": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"outputs": 1,
"output_only_on_state_change": true,
"for": 0,
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": true,
"ignorePrevStateUnknown": true,
"ignorePrevStateUnavailable": true,
"ignoreCurrentStateUnknown": true,
"ignoreCurrentStateUnavailable": true,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 180,
"y": 100,
"wires": [
[
"52ba0c04ab773b5b",
"066b4b6c53aea33d"
]
]
},
{
"id": "52ba0c04ab773b5b",
"type": "function",
"z": "2f7fb9c6403b335c",
"name": "Return 0/1",
"func": "if(msg.payload == 'ECO'){\n msg.payload = '0';\n msg.payload = Number(msg.payload);\n return msg;\n} else if (msg.payload == 'Confort'){\n msg.payload = '1';\n msg.payload = Number(msg.payload);\n return msg; \n} else {\n return null;\n}",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 450,
"y": 100,
"wires": [
[
"fdd93af093a7ccf6",
"d9de6485850cb0d4"
]
]
},
{
"id": "d48deecd9bf770e3",
"type": "inject",
"z": "2f7fb9c6403b335c",
"name": "Debug - send: 1",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "1",
"payloadType": "num",
"x": 400,
"y": 180,
"wires": [
[
"fdd93af093a7ccf6"
]
]
},
{
"id": "0376dc9f1b9d1a2c",
"type": "inject",
"z": "2f7fb9c6403b335c",
"name": "Debug - send: 0",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "0",
"payloadType": "num",
"x": 400,
"y": 140,
"wires": [
[
"fdd93af093a7ccf6"
]
]
},
{
"id": "4ec82ec3efe29f20",
"type": "modbus-write",
"z": "2f7fb9c6403b335c",
"name": "Write adress: 1001",
"showStatusActivities": false,
"showErrors": false,
"unitid": "",
"dataType": "HoldingRegister",
"adr": "1001",
"quantity": "1",
"server": "6837609d3ee526a4",
"emptyMsgOnFail": false,
"keepMsgProperties": false,
"x": 670,
"y": 320,
"wires": [
[],
[
"60cfb5d7d11bf7db"
]
]
},
{
"id": "65c548f3c2714cfb",
"type": "server-state-changed",
"z": "2f7fb9c6403b335c",
"name": "state_changed: Mode chaud/froid/auto",
"server": "d8cde96c5bee6be7",
"version": 3,
"exposeToHomeAssistant": false,
"haConfig": [
{
"property": "name",
"value": ""
},
{
"property": "icon",
"value": ""
}
],
"entityidfilter": "input_select.hitachi_1001_unit_mode",
"entityidfiltertype": "exact",
"outputinitially": false,
"state_type": "str",
"haltifstate": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"outputs": 1,
"output_only_on_state_change": true,
"for": 0,
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": true,
"ignorePrevStateUnknown": true,
"ignorePrevStateUnavailable": true,
"ignoreCurrentStateUnknown": true,
"ignoreCurrentStateUnavailable": true,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 190,
"y": 320,
"wires": [
[
"710a25518eb040d4",
"a6582ed0e0e447be"
]
]
},
{
"id": "710a25518eb040d4",
"type": "function",
"z": "2f7fb9c6403b335c",
"name": "Return 0/1/2",
"func": "if(msg.payload == 'Climatisation'){\n msg.payload = '0';\n msg.payload = Number(msg.payload);\n return msg;\n} else if (msg.payload == 'Chauffage'){\n msg.payload = '1';\n msg.payload = Number(msg.payload);\n return msg; \n} else if (msg.payload == 'Auto (chaud/froid)'){\n msg.payload = '2';\n msg.payload = Number(msg.payload);\n return msg; \n} else {\n return null;\n}",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 430,
"y": 320,
"wires": [
[
"4ec82ec3efe29f20",
"218fd559fb70a4d6"
]
]
},
{
"id": "5faf0c5e282ad85b",
"type": "inject",
"z": "2f7fb9c6403b335c",
"name": "Debug - send: 1",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "1",
"payloadType": "num",
"x": 400,
"y": 400,
"wires": [
[
"4ec82ec3efe29f20"
]
]
},
{
"id": "01b54de230cfb093",
"type": "inject",
"z": "2f7fb9c6403b335c",
"name": "Debug - send: 0",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "0",
"payloadType": "num",
"x": 400,
"y": 360,
"wires": [
[
"4ec82ec3efe29f20"
]
]
},
{
"id": "492e22f539eed6a1",
"type": "inject",
"z": "2f7fb9c6403b335c",
"name": "Debug - send: 2",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "2",
"payloadType": "num",
"x": 400,
"y": 440,
"wires": [
[
"4ec82ec3efe29f20"
]
]
},
{
"id": "60cfb5d7d11bf7db",
"type": "debug",
"z": "2f7fb9c6403b335c",
"name": "Sent",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 870,
"y": 320,
"wires": []
},
{
"id": "a6582ed0e0e447be",
"type": "debug",
"z": "2f7fb9c6403b335c",
"name": "Received",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 440,
"y": 280,
"wires": []
},
{
"id": "218fd559fb70a4d6",
"type": "debug",
"z": "2f7fb9c6403b335c",
"name": "Decoded",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 640,
"y": 280,
"wires": []
},
{
"id": "383623b69801446c",
"type": "debug",
"z": "2f7fb9c6403b335c",
"name": "Sent",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 870,
"y": 100,
"wires": []
},
{
"id": "d9de6485850cb0d4",
"type": "debug",
"z": "2f7fb9c6403b335c",
"name": "Decoded",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 640,
"y": 60,
"wires": []
},
{
"id": "066b4b6c53aea33d",
"type": "debug",
"z": "2f7fb9c6403b335c",
"name": "Received",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 440,
"y": 60,
"wires": []
},
{
"id": "6837609d3ee526a4",
"type": "modbus-client",
"name": "Hitachi",
"clienttype": "tcp",
"bufferCommands": true,
"stateLogEnabled": false,
"queueLogEnabled": false,
"failureLogEnabled": true,
"tcpHost": "192.168.1.60",
"tcpPort": "502",
"tcpType": "DEFAULT",
"serialPort": "/dev/ttyUSB",
"serialType": "RTU-BUFFERD",
"serialBaudrate": "9600",
"serialDatabits": "8",
"serialStopbits": "1",
"serialParity": "none",
"serialConnectionDelay": "100",
"serialAsciiResponseStartDelimiter": "0x3A",
"unit_id": 1,
"commandDelay": 1,
"clientTimeout": 1000,
"reconnectOnTimeout": true,
"reconnectTimeout": 2000,
"parallelUnitIdsAllowed": true
},
{
"id": "d8cde96c5bee6be7",
"type": "server",
"name": "HomeAssistant_Server",
"version": 1,
"legacy": false,
"addon": false,
"rejectUnauthorizedCerts": true,
"ha_boolean": "y|yes|true|on|home|open",
"connectionDelay": true,
"cacheJson": true
}
]