Projet Milight Hub avec gestion des états :
Définition :
Comment utiliser le protocole mqtt, avoir un nombre de zones illimité, une gesion des états et un nombre d’inter par lampe illimité, le tout avec les milights ?
Comment me soutenir ? haha abonnez-vous à ma chaine youtube : frpv
Installation :
A) Flashez le node MCU avec le firmware : GitHub - sidoh/esp8266_milight_hub: Replacement for a Milight/LimitlessLED hub hosted on an ESP8266
B) Configurez :
C) installez Nodered depuis la console :
Tapez :
bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)
Pour que ça démarre tout seul :
sudo systemctl enable nodered.service
D) Ouvrez nodered : IP-JeeDom:1880
E) Importez ce flow avec un copier/coller.
[
{
"id": "a4c7756b81c11545",
"type": "mqtt out",
"z": "f33852ce3944671f",
"name": "",
"topic": "milight/update/Node/Salon 1",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "ad0d92d78ef41a2b",
"x": 1300,
"y": 180,
"wires": []
},
{
"id": "2821fd4376c9cfa6",
"type": "mqtt out",
"z": "f33852ce3944671f",
"name": "",
"topic": "milight/update/Node/Salon 2",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "ad0d92d78ef41a2b",
"x": 1300,
"y": 240,
"wires": []
},
{
"id": "7fa38acc19b64896",
"type": "mqtt out",
"z": "f33852ce3944671f",
"name": "",
"topic": "milight/update/Node/Salon 3",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "ad0d92d78ef41a2b",
"x": 1300,
"y": 300,
"wires": []
},
{
"id": "037cd90ab003b892",
"type": "mqtt out",
"z": "f33852ce3944671f",
"name": "",
"topic": "milight/update/Node/Salon 4",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "ad0d92d78ef41a2b",
"x": 1300,
"y": 360,
"wires": []
},
{
"id": "8bca02ca90052148",
"type": "mqtt out",
"z": "f33852ce3944671f",
"name": "",
"topic": "milight/update/Node/Salon 5",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "ad0d92d78ef41a2b",
"x": 1300,
"y": 420,
"wires": []
},
{
"id": "449c3868b42c7982",
"type": "mqtt out",
"z": "f33852ce3944671f",
"name": "",
"topic": "milight/update/Node/Salon 6",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "ad0d92d78ef41a2b",
"x": 1300,
"y": 480,
"wires": []
},
{
"id": "585769aa8f7523d5",
"type": "mqtt out",
"z": "f33852ce3944671f",
"name": "",
"topic": "milight/update/Node/Salon 7",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "ad0d92d78ef41a2b",
"x": 1300,
"y": 540,
"wires": []
},
{
"id": "29e95173f23c8d88",
"type": "mqtt out",
"z": "f33852ce3944671f",
"name": "",
"topic": "milight/update/Node/Salon 8",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "ad0d92d78ef41a2b",
"x": 1300,
"y": 600,
"wires": []
},
{
"id": "603139f77943ca29",
"type": "comment",
"z": "f33852ce3944671f",
"name": "Gestion Etat Mqtt",
"info": "",
"x": 640,
"y": 20,
"wires": []
},
{
"id": "dce5ef4f5ef69ca9",
"type": "mqtt out",
"z": "f33852ce3944671f",
"name": "",
"topic": "milight/update/Node/Chambre 1",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "ad0d92d78ef41a2b",
"x": 1310,
"y": 760,
"wires": []
},
{
"id": "d87b2f5615e24283",
"type": "delay",
"z": "f33852ce3944671f",
"name": "",
"pauseType": "delay",
"timeout": "2",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 460,
"y": 100,
"wires": [
[
"cfc292360dbd1c6f"
]
]
},
{
"id": "46943e50d30a4af4",
"type": "function",
"z": "f33852ce3944671f",
"name": "function 1",
"func": "\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 320,
"y": 140,
"wires": [
[
"d87b2f5615e24283",
"d4f37f053673c649",
"bc6d2108aa863d33"
]
]
},
{
"id": "d4f37f053673c649",
"type": "delay",
"z": "f33852ce3944671f",
"name": "",
"pauseType": "delay",
"timeout": "3",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 460,
"y": 140,
"wires": [
[
"cfc292360dbd1c6f"
]
]
},
{
"id": "bc6d2108aa863d33",
"type": "delay",
"z": "f33852ce3944671f",
"name": "",
"pauseType": "delay",
"timeout": "4",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 460,
"y": 180,
"wires": [
[
"cfc292360dbd1c6f"
]
]
},
{
"id": "cfc292360dbd1c6f",
"type": "function",
"z": "f33852ce3944671f",
"name": "function 2",
"func": "\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 600,
"y": 140,
"wires": [
[
"a4c7756b81c11545",
"2821fd4376c9cfa6",
"7fa38acc19b64896",
"037cd90ab003b892",
"8bca02ca90052148",
"449c3868b42c7982",
"585769aa8f7523d5",
"29e95173f23c8d88"
]
]
},
{
"id": "89916de386786de8",
"type": "comment",
"z": "f33852ce3944671f",
"name": "Inter Salon 8 zones 0x11C9 Endroit : 1",
"info": "",
"x": 170,
"y": 180,
"wires": []
},
{
"id": "b1f50dcfc387d7f0",
"type": "comment",
"z": "f33852ce3944671f",
"name": "Inter Simple 0x11D0",
"info": "",
"x": 110,
"y": 900,
"wires": []
},
{
"id": "b04e3d19e35619e3",
"type": "comment",
"z": "f33852ce3944671f",
"name": "Repetition All Off",
"info": "",
"x": 460,
"y": 60,
"wires": []
},
{
"id": "274c5d03d0d61b0f",
"type": "comment",
"z": "f33852ce3944671f",
"name": "Zones Salon",
"info": "",
"x": 1330,
"y": 140,
"wires": []
},
{
"id": "b108ad06d370ed99",
"type": "comment",
"z": "f33852ce3944671f",
"name": "Zones Chambre 1",
"info": "",
"x": 1350,
"y": 720,
"wires": []
},
{
"id": "45929a54935ffcd2",
"type": "mqtt in",
"z": "f33852ce3944671f",
"name": "",
"topic": "milight/update/0x11C9/#",
"qos": "2",
"datatype": "auto-detect",
"broker": "ad0d92d78ef41a2b",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 100,
"y": 260,
"wires": [
[
"00edb5d604fb23f4"
]
]
},
{
"id": "00edb5d604fb23f4",
"type": "switch",
"z": "f33852ce3944671f",
"name": "",
"property": "topic",
"propertyType": "msg",
"rules": [
{
"t": "regex",
"v": "/1",
"vt": "str",
"case": false
},
{
"t": "regex",
"v": "/2",
"vt": "str",
"case": false
},
{
"t": "regex",
"v": "/3",
"vt": "str",
"case": false
},
{
"t": "regex",
"v": "/4",
"vt": "str",
"case": false
},
{
"t": "regex",
"v": "/5",
"vt": "str",
"case": false
},
{
"t": "regex",
"v": "/6",
"vt": "str",
"case": false
},
{
"t": "regex",
"v": "/7",
"vt": "str",
"case": false
},
{
"t": "regex",
"v": "/8",
"vt": "str",
"case": false
}
],
"checkall": "true",
"repair": false,
"outputs": 8,
"x": 450,
"y": 280,
"wires": [
[
"a4c7756b81c11545"
],
[
"2821fd4376c9cfa6"
],
[
"7fa38acc19b64896"
],
[
"037cd90ab003b892"
],
[
"8bca02ca90052148"
],
[
"449c3868b42c7982"
],
[
"585769aa8f7523d5"
],
[
"29e95173f23c8d88"
]
]
},
{
"id": "762a5384f4fab23c",
"type": "mqtt in",
"z": "f33852ce3944671f",
"name": "",
"topic": "milight/update/0x1D9/#",
"qos": "2",
"datatype": "auto-detect",
"broker": "ad0d92d78ef41a2b",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 120,
"y": 780,
"wires": [
[
"623ad54e052ea807"
]
]
},
{
"id": "623ad54e052ea807",
"type": "switch",
"z": "f33852ce3944671f",
"name": "",
"property": "topic",
"propertyType": "msg",
"rules": [
{
"t": "regex",
"v": "/1",
"vt": "str",
"case": false
},
{
"t": "regex",
"v": "/2",
"vt": "str",
"case": false
},
{
"t": "regex",
"v": "/3",
"vt": "str",
"case": false
},
{
"t": "regex",
"v": "/4",
"vt": "str",
"case": false
}
],
"checkall": "true",
"repair": false,
"outputs": 4,
"x": 450,
"y": 760,
"wires": [
[
"a4c7756b81c11545"
],
[
"dce5ef4f5ef69ca9"
],
[],
[]
]
},
{
"id": "86786b60e0f8e087",
"type": "comment",
"z": "f33852ce3944671f",
"name": "Inter Salon 4 zones 0x1D9",
"info": "",
"x": 130,
"y": 700,
"wires": []
},
{
"id": "d6b2c393f7076f15",
"type": "delay",
"z": "f33852ce3944671f",
"name": "",
"pauseType": "delay",
"timeout": "2",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 460,
"y": 620,
"wires": [
[
"77d23a4153e79775"
]
]
},
{
"id": "8841a3bcffc0de0a",
"type": "function",
"z": "f33852ce3944671f",
"name": "function 5",
"func": "\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 320,
"y": 660,
"wires": [
[
"d6b2c393f7076f15",
"622f1c18ebe666f9",
"d99107943a3a8d50"
]
]
},
{
"id": "622f1c18ebe666f9",
"type": "delay",
"z": "f33852ce3944671f",
"name": "",
"pauseType": "delay",
"timeout": "3",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 460,
"y": 660,
"wires": [
[
"77d23a4153e79775"
]
]
},
{
"id": "d99107943a3a8d50",
"type": "delay",
"z": "f33852ce3944671f",
"name": "",
"pauseType": "delay",
"timeout": "4",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 460,
"y": 700,
"wires": [
[
"77d23a4153e79775"
]
]
},
{
"id": "77d23a4153e79775",
"type": "function",
"z": "f33852ce3944671f",
"name": "function 6",
"func": "\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 600,
"y": 660,
"wires": [
[
"a4c7756b81c11545",
"dce5ef4f5ef69ca9"
]
]
},
{
"id": "beb1948aaaa1d23a",
"type": "comment",
"z": "f33852ce3944671f",
"name": "Repetition All Off",
"info": "",
"x": 460,
"y": 580,
"wires": []
},
{
"id": "87ed8156eeaa4305",
"type": "mqtt in",
"z": "f33852ce3944671f",
"name": "",
"topic": "milight/update/0x11D0/1",
"qos": "2",
"datatype": "auto-detect",
"broker": "ad0d92d78ef41a2b",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 120,
"y": 940,
"wires": [
[
"dce5ef4f5ef69ca9"
]
]
},
{
"id": "3705fd4aafc011d8",
"type": "mqtt in",
"z": "f33852ce3944671f",
"name": "",
"topic": "milight/update/0x1D9/0",
"qos": "2",
"datatype": "auto-detect",
"broker": "ad0d92d78ef41a2b",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 120,
"y": 740,
"wires": [
[
"8841a3bcffc0de0a"
]
]
},
{
"id": "6328a862b7c1d493",
"type": "mqtt in",
"z": "f33852ce3944671f",
"name": "",
"topic": "milight/update/0x11C9/0",
"qos": "2",
"datatype": "auto-detect",
"broker": "ad0d92d78ef41a2b",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 100,
"y": 220,
"wires": [
[
"46943e50d30a4af4"
]
]
},
{
"id": "f547a34a700a1868",
"type": "comment",
"z": "f33852ce3944671f",
"name": "Inter Salon 8 zones 0x11B7 Endroit : 2",
"info": "",
"x": 170,
"y": 320,
"wires": []
},
{
"id": "818cb0515d1e34f0",
"type": "mqtt in",
"z": "f33852ce3944671f",
"name": "",
"topic": "milight/update/0x11B7/#",
"qos": "2",
"datatype": "auto-detect",
"broker": "ad0d92d78ef41a2b",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 100,
"y": 400,
"wires": [
[
"00edb5d604fb23f4"
]
]
},
{
"id": "6bde477e46c85482",
"type": "mqtt in",
"z": "f33852ce3944671f",
"name": "",
"topic": "milight/update/0x11B7/0",
"qos": "2",
"datatype": "auto-detect",
"broker": "ad0d92d78ef41a2b",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 100,
"y": 360,
"wires": [
[
"46943e50d30a4af4"
]
]
},
{
"id": "9cea0d3516afc527",
"type": "comment",
"z": "f33852ce3944671f",
"name": "Exemple :D",
"info": "",
"x": 90,
"y": 40,
"wires": []
},
{
"id": "ad0d92d78ef41a2b",
"type": "mqtt-broker",
"name": "Broker Jeedom",
"broker": "192.168.1.37",
"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": ""
}
]
F)Afin de gérer les états, changez le nom de vos interrupteurs et configurez le broker sur l’ip de jeedom:1883
G) Installez le plugins : Jmqtt dans Jeedom.
H) Afin d’avoir ce rendu, j’ai installé le plugin’s ( payant) : Pimpmyjeedom.
I) Pour le bouton blanc : Menu outil de jeedom et allez dans Widgets.
Image du bouton :
J)Faites un bouton propre et après vous n’avez plus qu’a dupliquer les Zones dans le plugins Jmqtt et changer soit le nom de l’interrupteur soit la zone…
Conclusion :
-Chaud… mais pas impossible ;D
-ça marche plutôt bien et rapidement
-Il est même possible de créer des inter qui n’existent pas.
-Les Lampes n’ont donc pas le retour d’état ce qui m’a fait passer par nodered.
-Les lampes sont limitées à 4 interrupteurs. Si vous avez 5 et plus d’endroits pour allumer vos 8 zones… Alors avec nodered c’est possible. Il faut rediriger le flux de l’inter 5 dans par exemple l’inter1 . Mais voilà, ce 5 et plus n’allumera pas la lampe directement… ça passera par l’usine à gaz… Bref…
En définitive c’est plutôt très cool