@gaelbillon voila des explications pour le module Freebox de Node-RED
Dans un premier temps il faut créer un device MQTT avec les features Position du Volet et Etat du volet
Dans Node-RED il faut installer le module node-red-contrib-freebox et bien sûr créer la connexion avec le broker MQTT Gladys.
Lors de la première requête il faudra valider l’utilisation de Node-RED avec la Freebox.
Pour cela il faudra valider sur la façade de ta Freebox.
Ensuite il faudra donner l’autorisation à Node-RED de lire les infos du pack sécurité dans les paramètres de la Freebox.
Pour cela aller sur Freebox-OS, paramètres / gestion des accès
Dans Gestion des accès, dans l’onglet Application, tu dois retrouver une ligne correspondant à Node-RED
Cliquer sur le crayon de l’édition à droite
Cocher la case Gestion de l’alarme et maison connectée
Ci dessous un premier Flow pour tester la connexion et avoir le retour de tout tes devices du pack sécurité.
[
{
"id": "1d67dee27a16208d",
"type": "group",
"z": "d7c3929073ea7b03",
"name": "Call API Freebox",
"style": {
"fill": "#dbcbe7",
"label": true,
"color": "#000000"
},
"nodes": [
"4f8f16965ae54f50",
"72e75292b4cb21f9",
"7dd73ca182891c1b"
],
"x": 1254,
"y": 699,
"w": 552,
"h": 82
},
{
"id": "4f8f16965ae54f50",
"type": "api",
"z": "d7c3929073ea7b03",
"g": "1d67dee27a16208d",
"name": "",
"url": "",
"server": "35b9faf136b9302a",
"x": 1530,
"y": 740,
"wires": [
[
"72e75292b4cb21f9"
]
]
},
{
"id": "72e75292b4cb21f9",
"type": "debug",
"z": "d7c3929073ea7b03",
"g": "1d67dee27a16208d",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1690,
"y": 740,
"wires": []
},
{
"id": "7dd73ca182891c1b",
"type": "inject",
"z": "d7c3929073ea7b03",
"g": "1d67dee27a16208d",
"name": "/home/tileset",
"props": [
{
"p": "url",
"v": "/home/tileset/all",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 1370,
"y": 740,
"wires": [
[
"4f8f16965ae54f50"
]
]
},
{
"id": "35b9faf136b9302a",
"type": "freebox-server",
"host": "https://mafreebox.freebox.fr",
"port": "443"
}
]
Ci dessous le flow d’un volet
[
{
"id": "18e154108b13c26c",
"type": "group",
"z": "d7c3929073ea7b03",
"name": "Volet bureau",
"style": {
"stroke": "#7fb7df",
"label": true,
"fill": "#92d04f",
"color": "#000000"
},
"nodes": [
"3e15afd9376757c9",
"a49eaa136556eee7",
"a748fcd15020c73e",
"10b39b8328881bdb",
"1ecb5525b3ad37c6",
"a7c2664d98109c89",
"fd923244d0fb66d2",
"2a32a9e720ae58f3",
"31a13ffcc844be3f",
"26f4754086a73f61",
"768a96d8a1add8e5",
"3bdfec7e2be1d3cb",
"3dab952dd0a739a3",
"83331d58417a9467",
"30d53f3a1ed9df4c",
"277875ed0aa28e4b"
],
"x": 54,
"y": 1179,
"w": 1512,
"h": 342
},
{
"id": "3e15afd9376757c9",
"type": "mqtt in",
"z": "d7c3929073ea7b03",
"g": "18e154108b13c26c",
"name": "Gladys value",
"topic": "gladys/device/mqtt:volet_bureau/feature/mqtt:position_volet_bureau/state",
"qos": "2",
"datatype": "auto-detect",
"broker": "05eac840560ca08c",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 150,
"y": 1220,
"wires": [
[
"83331d58417a9467"
]
]
},
{
"id": "a49eaa136556eee7",
"type": "mqtt out",
"z": "d7c3929073ea7b03",
"g": "18e154108b13c26c",
"name": "Update Gladys value",
"topic": "gladys/master/device/mqtt:volet_bureau/feature/mqtt:position_volet_bureau/state",
"qos": "2",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "05eac840560ca08c",
"x": 1080,
"y": 1480,
"wires": []
},
{
"id": "a748fcd15020c73e",
"type": "mqtt in",
"z": "d7c3929073ea7b03",
"g": "18e154108b13c26c",
"name": "Gladys value",
"topic": "gladys/device/mqtt:volet_bureau/feature/mqtt:cmd_volet_bureau/state",
"qos": "2",
"datatype": "auto-detect",
"broker": "05eac840560ca08c",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 150,
"y": 1320,
"wires": [
[
"10b39b8328881bdb"
]
]
},
{
"id": "10b39b8328881bdb",
"type": "json",
"z": "d7c3929073ea7b03",
"g": "18e154108b13c26c",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 290,
"y": 1320,
"wires": [
[
"1ecb5525b3ad37c6"
]
]
},
{
"id": "1ecb5525b3ad37c6",
"type": "switch",
"z": "d7c3929073ea7b03",
"g": "18e154108b13c26c",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "1",
"vt": "num"
},
{
"t": "eq",
"v": "0",
"vt": "num"
},
{
"t": "eq",
"v": "-1",
"vt": "num"
}
],
"checkall": "true",
"repair": false,
"outputs": 3,
"x": 410,
"y": 1320,
"wires": [
[
"fd923244d0fb66d2",
"31a13ffcc844be3f"
],
[
"a7c2664d98109c89"
],
[
"2a32a9e720ae58f3",
"31a13ffcc844be3f"
]
],
"outputLabels": [
"Open",
"Stop",
"Close"
]
},
{
"id": "a7c2664d98109c89",
"type": "function",
"z": "d7c3929073ea7b03",
"g": "18e154108b13c26c",
"name": "STOP",
"func": "msg.url = \"/home/endpoints/30/1\"\nmsg.method = \"PUT\"\nmsg.payload = {\n \"value\": null\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 710,
"y": 1320,
"wires": [
[
"30d53f3a1ed9df4c"
]
]
},
{
"id": "fd923244d0fb66d2",
"type": "function",
"z": "d7c3929073ea7b03",
"g": "18e154108b13c26c",
"name": "OPEN",
"func": "msg.url = \"/home/endpoints/30/3\"\nmsg.method = \"PUT\"\nmsg.payload = {\n \"value\": 0\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 710,
"y": 1280,
"wires": [
[
"30d53f3a1ed9df4c"
]
]
},
{
"id": "2a32a9e720ae58f3",
"type": "function",
"z": "d7c3929073ea7b03",
"g": "18e154108b13c26c",
"name": "CLOSE",
"func": "msg.url = \"/home/endpoints/30/3\"\nmsg.method = \"PUT\"\nmsg.payload = {\n \"value\": 100\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 720,
"y": 1360,
"wires": [
[
"30d53f3a1ed9df4c"
]
]
},
{
"id": "31a13ffcc844be3f",
"type": "trigger",
"z": "d7c3929073ea7b03",
"g": "18e154108b13c26c",
"name": "Wait for stable value",
"op1": "",
"op2": "",
"op1type": "nul",
"op2type": "payl",
"duration": "15",
"extend": true,
"overrideDelay": false,
"units": "s",
"reset": "",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 500,
"y": 1400,
"wires": [
[
"3dab952dd0a739a3"
]
]
},
{
"id": "26f4754086a73f61",
"type": "poll",
"z": "d7c3929073ea7b03",
"g": "18e154108b13c26c",
"name": "Volet Bureau",
"url": "/home/tileset/30",
"interval": "3000",
"server": "35b9faf136b9302a",
"x": 150,
"y": 1480,
"wires": [
[
"768a96d8a1add8e5"
]
]
},
{
"id": "768a96d8a1add8e5",
"type": "function",
"z": "d7c3929073ea7b03",
"g": "18e154108b13c26c",
"name": "Get only the value",
"func": "msg.payload = 100 - msg.payload[0].data[0].value;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 750,
"y": 1480,
"wires": [
[
"a49eaa136556eee7"
]
]
},
{
"id": "3bdfec7e2be1d3cb",
"type": "mqtt out",
"z": "d7c3929073ea7b03",
"g": "18e154108b13c26c",
"name": "Update Gladys value",
"topic": "gladys/master/device/mqtt:volet_bureau/feature/mqtt:cmd_volet_bureau/state",
"qos": "2",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "05eac840560ca08c",
"x": 1080,
"y": 1400,
"wires": []
},
{
"id": "3dab952dd0a739a3",
"type": "function",
"z": "d7c3929073ea7b03",
"g": "18e154108b13c26c",
"name": "Set value to 0",
"func": "msg.payload = 0;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 740,
"y": 1400,
"wires": [
[
"3bdfec7e2be1d3cb"
]
]
},
{
"id": "83331d58417a9467",
"type": "function",
"z": "d7c3929073ea7b03",
"g": "18e154108b13c26c",
"name": "Convert to the correct value",
"func": "msg.url = \"/home/endpoints/30/3\"\nmsg.method = \"PUT\"\nmsg.payload = {\n \"value\": 100 - msg.payload\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 780,
"y": 1220,
"wires": [
[
"30d53f3a1ed9df4c"
]
]
},
{
"id": "30d53f3a1ed9df4c",
"type": "api",
"z": "d7c3929073ea7b03",
"g": "18e154108b13c26c",
"name": "",
"url": "",
"server": "35b9faf136b9302a",
"x": 1250,
"y": 1320,
"wires": [
[
"277875ed0aa28e4b"
]
]
},
{
"id": "277875ed0aa28e4b",
"type": "debug",
"z": "d7c3929073ea7b03",
"g": "18e154108b13c26c",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1450,
"y": 1320,
"wires": []
},
{
"id": "05eac840560ca08c",
"type": "mqtt-broker",
"name": "GladysMQTT",
"broker": "192.168.*.***",
"port": "1883",
"clientid": "",
"autoConnect": true,
"usetls": false,
"protocolVersion": "4",
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willPayload": "",
"willMsg": {},
"userProps": "",
"sessionExpiry": ""
},
{
"id": "35b9faf136b9302a",
"type": "freebox-server",
"host": "https://mafreebox.freebox.fr",
"port": "443"
}
]
Ce que tu obtiendras dans Gladys
Si tu as des questions n’hésites pas.