Pour le coup on est plus sur un ‹ probleme › d’ip local & duckdns. Je n utilise pas duck dns mais en https ou autre port sécurisé en local, tu as essayé ?
Et bien quand je mets l’adresse local dans mqtt explorer, il me déconnecte du server. Donc ça marche pas…
Tu utilises quoi au lieu de duckdns ?
Tu entends quoi par « port sécurisé en local » ?
Autre chose, quand je configuré mqqt dans ha, il me met core-brocker dans IP et je peux pas mettre l’adresse IP
je suis en full local, et pour l’exterieu je participe à Nabucasa.
dans mqtt brwser tu as ca :
en changeant le port et l’option encryption tts si necessaire
dans ton configuration.yaml :
#############################################################
##### OCTOPRINT ########
#############################################################
octoprint:
host: 192.x.x.x
api_key: E0xxxxxBx4xxxxxBfsfsAxxChdt7xx6ng,gfyxF
number_of_tools: 1
bed: true
et
Un grand merci à @jybi89 pour sa patience !!
Tout est rentré dans l’ordre. J’avoue ne pas trop savoir ce qui c’est passé.
J’ai tout enlevé, mqqt, octoprint et autre. Je suis repartie de 0. J’ai tout réinstallé petit à petit, avec tests à chaque fois en prenant mon temps !
Et voilà ça marche.
Merci
Un grand merci pour ce partage et ce beau tuto. Aussitôt mon imprimante 3D reçu je me suis empressé de suivre ce tuto quasi à la lettre et cela fonctionne parfaitement !
Pour l’automatisation sur laquelle tu t’interroge si elle est nécessaire ou pas : elle l’est pour mettre à jour le input_number.longueur_filament car autrement la valeur ne change pas quand on lance une nouvelle impression.
Pour le lovelace j’ai fait un mix entre ce que tu proposes (le suivi de la quantité de filament est juste top ) et la carte que mentionne @barto_95 qui est juste parfaite et avec l’animation en plus ça fait son petit effet
merci Thomas
j’utilise aussi la carte dangreco/threedy sur mon lovelace ‹ principal ›, en revanche je l’ai épurée au maximum pour n’avoir que l’animation et l’icone pour gérer la lumiere de l’imprimante. J’ai ensuite crée un dashboard dédié à l’impression 3D dont un onglet avec plein de raccourcis envoyant du Gcode via mqtt
Hello pour information via le plugin FilamentManager d’octoprint, il est possible de query via les API octoprint pour avoir l’état des filaments.
L’avantage est qu’Octoprint demande le type de filament au lancement (à configurer) et il décompte automatiquement le filament utilisé.
Je suis en train de mater ce qu’il est possible de faire/recup via les API et j’essayerais de faire un flow NodeRED.
EDIT : Bon la doc est pas très clair mais en m’étant le nez dans le code j’arrive à faire quelques truc
- Récupérer dynamiquement la liste des filaments
- La description de chaque filaments
- La quantité restante.
- …
EDIT 2 : Et voila via l’auto-discovery MQTT :
Pour la couleur, j’ai fait une bidouille dans le nom de la bobine dans Octoprint pour la récupérer automatiquement dans HA :
Bien vu ! Je connaissais ce plugin mais à ce moment personne ne savais comment récupérer ces infos
Tu peut même allez plus loin et allez jusqu’à renseigner depuis ha les bobines et profile si ont veut
Voici le flow Node-RED si tu veut faire joujou :
[{"id":"c149e48bea15ff25","type":"group","z":"85c70839c0b6be32","name":"FilamentManager","style":{"stroke":"#000000","fill":"#addb7b","label":true,"color":"#000000"},"nodes":["875a80342ba7f272","3e8386a587337e04","306884563dac1643","67e5ad1a648db995","335c7509a37f1a87","b1c0831515fb907b","b380bf8cb1407279","27dd6084663d4473","9792b0182ed43dc0","9d4cf91fc80217b9","9e84ca11197a4667"],"x":34,"y":29,"w":1132,"h":142},{"id":"875a80342ba7f272","type":"inject","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"300","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":150,"y":70,"wires":[["b380bf8cb1407279"]]},{"id":"3e8386a587337e04","type":"function","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"Get Spools","func":"msg.url = msg.octoprint_url+'/plugin/filamentmanager/spools'\nmsg.headers = {}\nmsg.headers['X-Api-Key'] = msg.api_key;\nmsg.method = \"GET\"\n \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":440,"y":70,"wires":[["306884563dac1643"]]},{"id":"306884563dac1643","type":"http request","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"","method":"use","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"x":610,"y":70,"wires":[["67e5ad1a648db995"]]},{"id":"67e5ad1a648db995","type":"json","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"","property":"payload","action":"","pretty":false,"x":760,"y":70,"wires":[["335c7509a37f1a87"]]},{"id":"335c7509a37f1a87","type":"change","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"Spools => Payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.spools","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":930,"y":70,"wires":[["b1c0831515fb907b"]]},{"id":"b1c0831515fb907b","type":"split","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":1090,"y":70,"wires":[["9792b0182ed43dc0"]]},{"id":"b380bf8cb1407279","type":"credentials","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"API Key","props":[{"value":"api_key","type":"msg"},{"value":"octoprint_url","type":"msg"},{"value":"ha_prefix","type":"msg"}],"x":290,"y":70,"wires":[["3e8386a587337e04"]]},{"id":"27dd6084663d4473","type":"mqtt out","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"","topic":"","qos":"0","retain":"true","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"94fffe91.c7ff7","x":980,"y":130,"wires":[]},{"id":"9792b0182ed43dc0","type":"function","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"Format Sensor for Auto-Discovery","func":"var payload = msg.payload\nvar profile = payload.profile\n\nmsg.payload = []\nmsg.payload.push({\n \"topic\": msg.ha_prefix+\"/sensor/octoprint/filament_\"+payload.id+\"/config\",\n \"payload\": {\n \"name\": \"filament_\"+payload.id,\n \"uniq_id\": \"filament_\"+payload.id,\n \"stat_t\": msg.ha_prefix+\"/sensor/octoprint/filament_\"+payload.id+\"/state\",\n \"json_attr_t\": msg.ha_prefix+\"/sensor/octoprint/filament_\"+payload.id+\"/attributes\",\n \"unit_of_measurement\": \"g\",\n \"device\": {\n \"identifiers\": [ \"filament_\"+payload.id ],\n \"name\": payload.name,\n \"model\": profile.material,\n \"manufacturer\": profile.vendor\n }\n }\n})\n\n\nname = payload.name.split(\" / \")[0]\ncolor = payload.name.split(\" / \")[1]\nrestant = payload.weight - payload.used\nused_percent = 100 * payload.used / payload.weight\nstate_percent = 100 - used_percent\n\nmsg.payload.push({\n \"topic\": msg.ha_prefix+\"/sensor/octoprint/filament_\"+payload.id+\"/attributes\",\n \"payload\": {\n \"id\": payload.id,\n \"cost\": payload.cost,\n \"name\": name,\n \"color\": color,\n \"temp_offset\": payload.temp_offset,\n \"used\": payload.used.toFixed(1),\n \"used_percent\": used_percent.toFixed(1),\n \"state_percent\": state_percent.toFixed(1),\n \"weight\": payload.weight,\n \"density\": profile.density,\n \"diameter\": profile.diameter,\n \"material\": profile.material,\n \"vendor\": profile.vendor\n }\n})\n\nmsg.payload.push({\n \"topic\": msg.ha_prefix+\"/sensor/octoprint/filament_\"+payload.id+\"/state\",\n \"payload\": restant.toFixed(1)\n})\n \n \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":290,"y":130,"wires":[["9d4cf91fc80217b9"]]},{"id":"9d4cf91fc80217b9","type":"split","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":550,"y":130,"wires":[["9e84ca11197a4667"]]},{"id":"9e84ca11197a4667","type":"change","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"Format Topic & Payload","rules":[{"t":"set","p":"topic","pt":"msg","to":"payload.topic","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":"payload.payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":780,"y":130,"wires":[["27dd6084663d4473"]]},{"id":"94fffe91.c7ff7","type":"mqtt-broker","name":"Mosquitto","broker":"mosquitto.mosquitto","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"5","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]
La partie haute s’occupe de la récupération des infos dans OctoPrint.
Ne pas oublier de configurer les divers « credentials » dans le node « API Key »
La partie basse s’occupe de créer les sensor dans MQTT pour transmettre les informations à HA
Je viens de faire une évolution du flow pour récupérer les informations sur le filament actuellement sélectionnés :
[{"id":"c149e48bea15ff25","type":"group","z":"85c70839c0b6be32","name":"FilamentManager","style":{"stroke":"#000000","fill":"#addb7b","label":true,"color":"#000000"},"nodes":["875a80342ba7f272","3e8386a587337e04","306884563dac1643","67e5ad1a648db995","335c7509a37f1a87","b1c0831515fb907b","b380bf8cb1407279","27dd6084663d4473","9792b0182ed43dc0","9d4cf91fc80217b9","9e84ca11197a4667","56d73242208e035c","cf4b9feca6db9d43","f78bbc85fd3c2a8e","87c36504dd947da8","5743f9277fe69799","1e04c7ea67db3cd3"],"x":34,"y":29,"w":1952,"h":122},{"id":"875a80342ba7f272","type":"inject","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"300","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":150,"y":70,"wires":[["b380bf8cb1407279"]]},{"id":"3e8386a587337e04","type":"function","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"Get Spools","func":"msg.url = msg.octoprint_url+'/plugin/filamentmanager/spools'\nmsg.headers = {}\nmsg.headers['X-Api-Key'] = msg.api_key;\nmsg.method = \"GET\"\n \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":450,"y":70,"wires":[["306884563dac1643"]]},{"id":"306884563dac1643","type":"http request","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"","method":"use","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"x":610,"y":70,"wires":[["67e5ad1a648db995"]]},{"id":"67e5ad1a648db995","type":"json","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"","property":"payload","action":"","pretty":false,"x":760,"y":70,"wires":[["335c7509a37f1a87"]]},{"id":"335c7509a37f1a87","type":"change","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"Spools => Payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.spools","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":930,"y":70,"wires":[["b1c0831515fb907b"]]},{"id":"b1c0831515fb907b","type":"split","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":1090,"y":70,"wires":[["9792b0182ed43dc0"]]},{"id":"b380bf8cb1407279","type":"credentials","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"API Key","props":[{"value":"api_key","type":"msg"},{"value":"octoprint_url","type":"msg"},{"value":"ha_prefix","type":"msg"}],"x":300,"y":70,"wires":[["3e8386a587337e04","56d73242208e035c"]]},{"id":"27dd6084663d4473","type":"mqtt out","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"","topic":"","qos":"0","retain":"true","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"94fffe91.c7ff7","x":1910,"y":90,"wires":[]},{"id":"9792b0182ed43dc0","type":"function","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"Format Sensor for Auto-Discovery","func":"var payload = msg.payload\nvar profile = payload.profile\n\nmsg.payload = []\nmsg.payload.push({\n \"topic\": msg.ha_prefix+\"/sensor/octoprint/filament_\"+payload.id+\"/config\",\n \"payload\": {\n \"name\": \"filament_\"+payload.id,\n \"uniq_id\": \"filament_\"+payload.id,\n \"stat_t\": msg.ha_prefix+\"/sensor/octoprint/filament_\"+payload.id+\"/state\",\n \"json_attr_t\": msg.ha_prefix+\"/sensor/octoprint/filament_\"+payload.id+\"/attributes\",\n \"unit_of_measurement\": \"g\",\n \"device\": {\n \"identifiers\": [ \"filament_\"+payload.id ],\n \"name\": payload.name,\n \"model\": profile.material,\n \"manufacturer\": profile.vendor\n }\n }\n})\n\n\nname = payload.name.split(\" / \")[0]\ncolor = payload.name.split(\" / \")[1]\nrestant = payload.weight - payload.used\nused_percent = 100 * payload.used / payload.weight\nstate_percent = 100 - used_percent\n\nmsg.payload.push({\n \"topic\": msg.ha_prefix+\"/sensor/octoprint/filament_\"+payload.id+\"/attributes\",\n \"payload\": {\n \"id\": payload.id,\n \"cost\": payload.cost,\n \"name\": name,\n \"color\": color,\n \"temp_offset\": payload.temp_offset,\n \"used\": payload.used.toFixed(1),\n \"used_percent\": used_percent.toFixed(1),\n \"state_percent\": state_percent.toFixed(1),\n \"weight\": payload.weight,\n \"density\": profile.density,\n \"diameter\": profile.diameter,\n \"material\": profile.material,\n \"vendor\": profile.vendor\n }\n})\n\nmsg.payload.push({\n \"topic\": msg.ha_prefix+\"/sensor/octoprint/filament_\"+payload.id+\"/state\",\n \"payload\": restant.toFixed(1)\n})\n \n \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1310,"y":70,"wires":[["9d4cf91fc80217b9"]]},{"id":"9d4cf91fc80217b9","type":"split","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":1550,"y":90,"wires":[["9e84ca11197a4667"]]},{"id":"9e84ca11197a4667","type":"change","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"Format Topic & Payload","rules":[{"t":"set","p":"topic","pt":"msg","to":"payload.topic","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":"payload.payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1730,"y":90,"wires":[["27dd6084663d4473"]]},{"id":"56d73242208e035c","type":"function","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"Get Selections","func":"msg.url = msg.octoprint_url+'/plugin/filamentmanager/selections'\nmsg.headers = {}\nmsg.headers['X-Api-Key'] = msg.api_key;\nmsg.method = \"GET\"\n \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":460,"y":110,"wires":[["cf4b9feca6db9d43"]]},{"id":"cf4b9feca6db9d43","type":"http request","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"","method":"use","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"x":630,"y":110,"wires":[["f78bbc85fd3c2a8e"]]},{"id":"f78bbc85fd3c2a8e","type":"json","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"","property":"payload","action":"","pretty":false,"x":770,"y":110,"wires":[["87c36504dd947da8"]]},{"id":"87c36504dd947da8","type":"change","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"Selections => Payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.selections","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":940,"y":110,"wires":[["5743f9277fe69799"]]},{"id":"5743f9277fe69799","type":"split","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":1110,"y":110,"wires":[["1e04c7ea67db3cd3"]]},{"id":"1e04c7ea67db3cd3","type":"function","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"Format Sensor for Auto-Discovery","func":"var payload = msg.payload\nvar spool = payload.spool\nvar profile = spool.profile\n\nmsg.payload = []\nmsg.payload.push({\n \"topic\": msg.ha_prefix+\"/sensor/octoprint/filament_select/config\",\n \"payload\": {\n \"name\": \"filament_select\",\n \"uniq_id\": \"filament_select\",\n \"stat_t\": msg.ha_prefix+\"/sensor/octoprint/filament_select/state\",\n \"json_attr_t\": msg.ha_prefix+\"/sensor/octoprint/filament_select/attributes\",\n \"unit_of_measurement\": \"g\",\n \"device\": {\n \"identifiers\": [ \"filament_select\" ],\n \"name\": spool.name,\n \"model\": profile.material,\n \"manufacturer\": profile.vendor\n }\n }\n})\n\n\nname = spool.name.split(\" / \")[0]\ncolor = spool.name.split(\" / \")[1]\nrestant = spool.weight - spool.used\nused_percent = 100 * spool.used / spool.weight\nstate_percent = 100 - used_percent\n\nmsg.payload.push({\n \"topic\": msg.ha_prefix+\"/sensor/octoprint/filament_select/attributes\",\n \"payload\": {\n \"cost\": spool.cost,\n \"name\": name,\n \"color\": color,\n \"temp_offset\": spool.temp_offset,\n \"used\": spool.used.toFixed(1),\n \"used_percent\": used_percent.toFixed(1),\n \"state_percent\": state_percent.toFixed(1),\n \"weight\": spool.weight,\n \"density\": profile.density,\n \"diameter\": profile.diameter,\n \"material\": profile.material,\n \"vendor\": profile.vendor\n }\n})\n\nmsg.payload.push({\n \"topic\": msg.ha_prefix+\"/sensor/octoprint/filament_select/state\",\n \"payload\": restant.toFixed(1)\n})\n \n \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1320,"y":110,"wires":[["9d4cf91fc80217b9"]]},{"id":"94fffe91.c7ff7","type":"mqtt-broker","name":"Mosquitto","broker":"mosquitto.mosquitto","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"5","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]
EDIT : J’ai changer le state du sensor de filament sélectionné au format :
[MATERIAL] VENDOR : NAME
Exemple :
[PLA] Wanhao : Noir Premium
[{"id":"c149e48bea15ff25","type":"group","z":"85c70839c0b6be32","name":"FilamentManager","style":{"stroke":"#000000","fill":"#addb7b","label":true,"color":"#000000"},"nodes":["875a80342ba7f272","3e8386a587337e04","306884563dac1643","67e5ad1a648db995","335c7509a37f1a87","b1c0831515fb907b","b380bf8cb1407279","27dd6084663d4473","9792b0182ed43dc0","9d4cf91fc80217b9","9e84ca11197a4667","56d73242208e035c","cf4b9feca6db9d43","f78bbc85fd3c2a8e","87c36504dd947da8","5743f9277fe69799","1e04c7ea67db3cd3"],"x":34,"y":29,"w":1952,"h":122},{"id":"875a80342ba7f272","type":"inject","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"300","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":150,"y":70,"wires":[["b380bf8cb1407279"]]},{"id":"3e8386a587337e04","type":"function","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"Get Spools","func":"msg.url = msg.octoprint_url+'/plugin/filamentmanager/spools'\nmsg.headers = {}\nmsg.headers['X-Api-Key'] = msg.api_key;\nmsg.method = \"GET\"\n \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":450,"y":70,"wires":[["306884563dac1643"]]},{"id":"306884563dac1643","type":"http request","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"","method":"use","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"x":610,"y":70,"wires":[["67e5ad1a648db995"]]},{"id":"67e5ad1a648db995","type":"json","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"","property":"payload","action":"","pretty":false,"x":760,"y":70,"wires":[["335c7509a37f1a87"]]},{"id":"335c7509a37f1a87","type":"change","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"Spools => Payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.spools","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":930,"y":70,"wires":[["b1c0831515fb907b"]]},{"id":"b1c0831515fb907b","type":"split","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":1090,"y":70,"wires":[["9792b0182ed43dc0"]]},{"id":"b380bf8cb1407279","type":"credentials","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"API Key","props":[{"value":"api_key","type":"msg"},{"value":"octoprint_url","type":"msg"},{"value":"ha_prefix","type":"msg"}],"x":300,"y":70,"wires":[["3e8386a587337e04","56d73242208e035c"]]},{"id":"27dd6084663d4473","type":"mqtt out","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"","topic":"","qos":"0","retain":"true","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"94fffe91.c7ff7","x":1910,"y":90,"wires":[]},{"id":"9792b0182ed43dc0","type":"function","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"Format Sensor for Auto-Discovery","func":"var payload = msg.payload\nvar profile = payload.profile\n\nmsg.payload = []\nmsg.payload.push({\n \"topic\": msg.ha_prefix+\"/sensor/octoprint/filament_\"+payload.id+\"/config\",\n \"payload\": {\n \"name\": \"filament_\"+payload.id,\n \"uniq_id\": \"filament_\"+payload.id,\n \"stat_t\": msg.ha_prefix+\"/sensor/octoprint/filament_\"+payload.id+\"/state\",\n \"json_attr_t\": msg.ha_prefix+\"/sensor/octoprint/filament_\"+payload.id+\"/attributes\",\n \"unit_of_measurement\": \"g\",\n \"device\": {\n \"identifiers\": [ \"filament_\"+payload.id ],\n \"name\": payload.name,\n \"model\": profile.material,\n \"manufacturer\": profile.vendor\n }\n }\n})\n\n\nname = payload.name.split(\" / \")[0]\ncolor = payload.name.split(\" / \")[1]\nrestant = payload.weight - payload.used\nused_percent = 100 * payload.used / payload.weight\nstate_percent = 100 - used_percent\n\nmsg.payload.push({\n \"topic\": msg.ha_prefix+\"/sensor/octoprint/filament_\"+payload.id+\"/attributes\",\n \"payload\": {\n \"id\": payload.id,\n \"cost\": payload.cost,\n \"name\": name,\n \"color\": color,\n \"temp_offset\": payload.temp_offset,\n \"used\": payload.used.toFixed(1),\n \"used_percent\": used_percent.toFixed(1),\n \"state_percent\": state_percent.toFixed(1),\n \"weight\": payload.weight,\n \"density\": profile.density,\n \"diameter\": profile.diameter,\n \"material\": profile.material,\n \"vendor\": profile.vendor\n }\n})\n\nmsg.payload.push({\n \"topic\": msg.ha_prefix+\"/sensor/octoprint/filament_\"+payload.id+\"/state\",\n \"payload\": restant.toFixed(1)\n})\n \n \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1310,"y":70,"wires":[["9d4cf91fc80217b9"]]},{"id":"9d4cf91fc80217b9","type":"split","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":1550,"y":90,"wires":[["9e84ca11197a4667"]]},{"id":"9e84ca11197a4667","type":"change","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"Format Topic & Payload","rules":[{"t":"set","p":"topic","pt":"msg","to":"payload.topic","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":"payload.payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1730,"y":90,"wires":[["27dd6084663d4473"]]},{"id":"56d73242208e035c","type":"function","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"Get Selections","func":"msg.url = msg.octoprint_url+'/plugin/filamentmanager/selections'\nmsg.headers = {}\nmsg.headers['X-Api-Key'] = msg.api_key;\nmsg.method = \"GET\"\n \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":460,"y":110,"wires":[["cf4b9feca6db9d43"]]},{"id":"cf4b9feca6db9d43","type":"http request","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"","method":"use","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"x":630,"y":110,"wires":[["f78bbc85fd3c2a8e"]]},{"id":"f78bbc85fd3c2a8e","type":"json","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"","property":"payload","action":"","pretty":false,"x":770,"y":110,"wires":[["87c36504dd947da8"]]},{"id":"87c36504dd947da8","type":"change","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"Selections => Payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.selections","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":940,"y":110,"wires":[["5743f9277fe69799"]]},{"id":"5743f9277fe69799","type":"split","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":1110,"y":110,"wires":[["1e04c7ea67db3cd3"]]},{"id":"1e04c7ea67db3cd3","type":"function","z":"85c70839c0b6be32","g":"c149e48bea15ff25","name":"Format Sensor for Auto-Discovery","func":"var payload = msg.payload\nvar spool = payload.spool\nvar profile = spool.profile\n\nmsg.payload = []\nmsg.payload.push({\n \"topic\": msg.ha_prefix+\"/sensor/octoprint/filament_select/config\",\n \"payload\": {\n \"name\": \"filament_select\",\n \"uniq_id\": \"filament_select\",\n \"stat_t\": msg.ha_prefix+\"/sensor/octoprint/filament_select/state\",\n \"json_attr_t\": msg.ha_prefix+\"/sensor/octoprint/filament_select/attributes\",\n // \"unit_of_measurement\": \"g\",\n \"device\": {\n \"identifiers\": [ \"filament_select\" ],\n \"name\": spool.name,\n \"model\": profile.material,\n \"manufacturer\": profile.vendor\n }\n }\n})\n\n\nname = spool.name.split(\" / \")[0]\ncolor = spool.name.split(\" / \")[1]\nrestant = spool.weight - spool.used\nused_percent = 100 * spool.used / spool.weight\nstate_percent = 100 - used_percent\n\nmsg.payload.push({\n \"topic\": msg.ha_prefix+\"/sensor/octoprint/filament_select/attributes\",\n \"payload\": {\n \"cost\": spool.cost,\n \"name\": name,\n \"color\": color,\n \"temp_offset\": spool.temp_offset,\n \"used\": spool.used.toFixed(1),\n \"used_percent\": used_percent.toFixed(1),\n \"state_percent\": state_percent.toFixed(1),\n \"weight\": spool.weight,\n \"density\": profile.density,\n \"diameter\": profile.diameter,\n \"material\": profile.material,\n \"vendor\": profile.vendor\n }\n})\n\nmsg.payload.push({\n \"topic\": msg.ha_prefix+\"/sensor/octoprint/filament_select/state\",\n \"payload\": \"[\"+profile.material+\"] \"+profile.vendor+\" : \"+name\n})\n \n \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1320,"y":110,"wires":[["9d4cf91fc80217b9"]]},{"id":"94fffe91.c7ff7","type":"mqtt-broker","name":"Mosquitto","broker":"mosquitto.mosquitto","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"5","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]
Salut à tous.
Super Tuto.
Félicitations à l’auteur.
allez @Clemalex j’ai besoin de toi
suite à la maj 2022.2 j’ai ce sensor qui n’est plus dispo :
#### recuperation de mqtt et calcul de la longueur de filament en metres :
- platform: mqtt
name: "Longueur Filament"
state_topic: "octoPrint/hass/printing"
value_template: "{{ ((value_json.job.filament.tool0.length) | float * 0.001) | round(2) }}"
json_attributes_topic: "octoPrint/hass/printing"
json_attributes_template: "{{ value_json.job.filament.tool0 | tojson }}"
unit_of_measurement: "m"
j’ai surement mal regardé la doc Créer une entité à partir d’une ligne MQTT - Protocoles de communication / MQTT - Home Assistant Communauté Francophone (hacf.fr) mais apres plusieurs google translate je ne vois pas où est le probleme… ca te parle?? (j’ai essayé de remplacer value_template par state_value_template sans succès
—>> suite à la maj 2022.2.1 de ce matin, j’ai recuperé le sensor…
Bonjour
Nouveau utilisateur d’une imprimante 3D (FLSUN V400) est il possible d’intégrer cette imprimante dans HA ?
Merci
salut @titou43 oui tu dois pouvoir à partir du moment que tu as octoprint de fonctionnel.
Oui c’est très facile.
J’ai un Raspberry Pi4 avec caméra et Octoprint vers l’imprimante 3D.
Un ‹ shield › avec 4 relais, connecté aux sorties GPIO du Raspberry me permet de piloter la mise sous tension de l’imprimante, l’éclairage , le ventilateur et le chauffage du caisson de l’imprimante 3D.
J’ai ensuite installé l’intégration Octoprint sur Home Assistant.
et voici l’écran d’Octoprint:
Bonjour
Il n’y a pas Octoprint d’installé sur l’imprimante FLSUN V400…
Elle dispose d’un écran tactile (speederpad) dans lequel il y a moonraker, mainsail et klipper)
Je pensais que cela pouvait le faire …mais apparemment non