[TUTO] intégrer son imprimante 3d et gérer le stock de filaments et +

Disclaimer : c’est un tuto éducatif à ne pas réaliser sans réfléchir et sans savoir ce que vous faites, il s’agit de votre matériel et de votre responsabilité.

Objectifs

  • intégrer les données de votre imprimante 3D dans HA,
  • interagir sur votre imprimante à partir de Home Assistant (allumage, extraction total du filament pour prévoir un changement de filament, contrôle des états, les commandes d’arrêt d’urgences, contrôle de l’alimentation…),
  • gérer vos consommables (filaments) sur lovelace avec alerte avant la fin de la bobine,
  • commandes additionnelles sur un écran tactile Nextion et faire remonter les informations de l’imprimante sur l’écran,
  • allumage des LED lorsqu’elles passent en état ‹ Printing ›,
  • allumage des LED style guirlande de Noël lorsque l’impression est terminée,
  • notification avec photo de l’impression envoyée sur Telegram,
  • extinction de l’imprimante 20 mn après la fin de l’impression (respectant le refroidissement du nozzle).

Niveau

  • Intermédiaire ou débutant courageux

Materiels utilisés

  • une ender 3 v2 ou une autre imprimante 3D
  • du filament …
  • un RaspBerry PI pour Octoprint
  • un bout de ruban led + weemos D1 mini
  • un écran nextion 2.4 + 1 weemos D1 mini
  • une prise commandée (par exemple TPLink HS110) qui permet le contrôle électrique + les informations de consommation
  • une caméra (logitech C270)

Prérequis

  • une imprimante 3D (… sans blague…); j’utilise le firmware MARLIN car il faut activer l’option FWRETRACT (il suffit d’enlever la remarque dans configuration_adv.h)
  • une installation d’Octoprint opérationnelle
  • Octoprint connecté et communicant avec votre imprimante 3D
  • MQTT dans HA
  • Octoprint avec le plugin mqtt fonctionnel (vérifier avec MQTT explorer par exemple)
  • Telegram ou autre système de notification
  • savoir faire du copier coller
  • Node-RED (ou savoir faire des macro-gcode) /!\ tous ce qui est fait sous Node-RED est réalisable en Yaml
  • quelques neurones pas trop grillés…
  • du temps
  • de l’imagination pour parfaire ce tuto à vos besoins et vos envies.

Par quoi commencer… ?

Octoprint et Home Assistant

bah déjà brancher votre imprimante, connectez-y votre RPi avec Octoprint d’installé dessus. Je ne reviendrais pas spécialement là dessus puisque que c’est super simple et beaucoup de tuto existent (bien que franchement pas nécessaire vu la simplicité d’Octoprint).

Assurez vous d’installer le plugin Octoprint MQTT :

puis le plugin Octoprint HomeAssistant Discovery :

Conseil : installer aussi le plugin PortLister, il permettra à Octoprint de se reconnecter automatiquement à l’imprimante quand on la rallumera.

Faite l’intégration HA d’Octoprint :
OctoPrint - Home Assistant (home-assistant.io)

code
#############################################################
#####                     OCTOPRINT                  ########
#############################################################
Octoprint:
  host: 192.168.*.***
  api_key: E123456789123456789123456789123F
  number_of_tools: 1
  bed: true

Intégrer votre caméra qui est connectée au raspberry qui héberge Octoprint :

/!\ elle doit etre déjà reconnu dans Octoprint …bah sinon ca va pas marcher…

Code pour intégrer la caméra dans HA :

code
#############################################################
########                     CAMERA                  ########
#############################################################
camera:
  - platform: mjpeg
    name: OctoPrint
    still_image_url: http://192.168.*.***/webcam/?action=snapshot
    mjpeg_url: http://192.168.*.***/webcam/?action=stream

A partir de là, vous êtes en mesure de faire une carte avec la vidéo de votre caméra et récupérer les sensors d’Octoprint :


et MQTT dans tout ça ?

Vous avez installé le plugin MQTT dans Octoprint et vous avez le plugin Mosquitto Broker dans HA , donc le plugin MQTT d’Octoprint et Home Assistant peuvent communiquer et apporter d’avantage d’informations. Vous verrez, la configuration du plugin d’Octoprint vous demande juste vos crédencials :

1

et dans sensor rajouter ces lignes :

code
#################################################################
###############      Ender 3 imprimante 3D      #################
#################################################################
  - platform: Octoprint
    sensors:
    monitored_conditions:
      - 'Current State'
      - 'Temperatures'
      - 'Job Percentage'
      - 'Time Elapsed'
      - 'Time Remaining'

  - 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"

        

Coté cartes Lovelace

Vous pouvez maintenant créer vos cartes sur lovelace. Voici mon exemple mais vous pourrez l’ajuster à vos envies comme vous le souhaitez.

Carte pour l’apercu

Vous trouverez plusieurs cartes existantes sur Github dont celle ci :

code
card:
  cards:
    - type: glance
      entities:
        - entity: binary_sensor.Octoprint_printing
          name: Statut
        - entity: binary_sensor.Octoprint_printing_error
          name: Erreur
        - entity: sensor.Octoprint_current_state
          name: Etat
        - type: button
          tap_action:
            action: toggle
          entity: switch.tplink_ender3v2
          name: Ender 3v2
    - cards: null
      type: 'custom:bar-card'
      entities:
        - entity: sensor.Octoprint_job_percentage
      icon: 'hacf:progression'
    - entities:
        - entity: sensor.Octoprint_print_time_left
          name: Temps d'impression restant
        - entity: sensor.Octoprint_print_time
          name: Temps d'impression total
        - entity: sensor.Octoprint_print_file
          name: Fichier en cours d'impression
        - entity: sensor.Octoprint_tool_0_temperature
          name: Temperature du noozle
        - entity: sensor.Octoprint_bed_temperature
          name: Temperature du bed
        - entity: sensor.longueur_filament
          icon: 'hacf:filament'
      show_header_toggle: false
      type: entities
    - cards:
        - entity: switch.Octoprint_emergency_stop
          hold_action:
            action: more-info
          name: Stop
          show_icon: true
          show_name: true
          type: button
        - entity: switch.Octoprint_cancel_print
          hold_action:
            action: more-info
          name: Cancel
          show_icon: true
          show_name: true
          type: button
        - entity: switch.Octoprint_pause_print
          hold_action:
            action: more-info
          name: Pause
          show_icon: true
          show_name: true
          type: button
        - entity: switch.Octoprint_shutdown_system
          hold_action:
            action: more-info
          name: Shutdown
          show_icon: true
          show_name: true
          type: button
      type: horizontal-stack
  mode: vertical
  type: 'custom:stack-in-card'
conditions: []
type: conditional

Carte de gestion des filaments

Les buts de cette carte est :

  • d’afficher l’état de vos bobines (l’avantage est de slicer votre fichier STL donc de voir la quantité de filament requis! donc de ne pas lancer l’impression si vous n’en n’avez pas assez !),
  • via une condition (en cas de détection du statut Print), de déduire la quantité de filament pour votre print afin d’avoir une idée de ce qu’il vous reste de filament.

Avec ces 2 cartes vous savez combien de mètre de de filament vous aurez besoin pour imprimer votre fichier et combien il vous en reste !

Pour synthétiser la logique :

  • lors de la détection d’une impression

    • de reprendre l’information d’Octoprint du filament nécessaire pour le print,
    • de choisir (en cliquant ou avec le doigt pour les écrans tactiles) la bobine de filament concernée.

    Ainsi le nombre de mètres de filament nécessaire en sera déduit ET dans le cas où une bobine arrive à x mètres restant alors l’icône changera en panneau danger /!\ et vous recevrez une notification.

    3

    Bref, quand une impression est détectée, votre print utilise 3m de rouge, vous appuyez ou cliquez sur la jauge rouge et elle se verra diminuée de 3m avec un icone d’alerte et une notification si besoin :slight_smile:

  • Reset du Filament : dans le cas où vous changez une bobine , le bouton Reset Filament vous permettra de revenir à longueur correspondant à une bobine neuve.

Pour cette gestion de bobines de filaments, il faudra donc faire des input_boolean, input_number et des scripts et la carte.

La carte

Voici déjà le code de la carte qui devrait vous aider à comprendre le besoin d’avoir des input_boolean et input_number et des scripts :

code
type: vertical-stack
cards:
  - type: 'custom:stack-in-card'
    cards:
      - type: conditional
        conditions:
          - entity: sensor.Octoprint_current_state
            state: Printing
        card:
          type: 'custom:stack-in-card'
          cards:
            - type: markdown
              content: >-
                <font color="#FFFFFF">Détectection d'impression 3D. Choisir la
                bobine <font color="#FFFFFFF"><ha-icon
                icon="hacf:filament"></ha-icon>
            - direction: up
              entities:
                - color: black
                  entity: input_number.filament_noir_restant
                  icon: 'mdi:printer-3d-nozzle'
                  name: ' '
                  severity:
                    - from: '1'
                      to: '50'
                      icon: 'mdi:alert'
                      color: black
                    - from: '50'
                      to: '330'
                      color: black
                      icon: 'mdi:printer-3d-nozzle'
                  max: '330'
                  min: '0'
                  tap_action:
                    action: call-service
                    service: script.mise_a_jour_bobine_noir
                - color: white
                  entity: input_number.filament_blanc_restant
                  icon: 'mdi:printer-3d-nozzle'
                  name: ' '
                  severity:
                    - from: '1'
                      to: '50'
                      icon: 'mdi:alert'
                      color: white
                    - from: '50'
                      to: '330'
                      color: white
                      icon: 'mdi:printer-3d-nozzle'
                  max: '330'
                  min: '0'
                  tap_action:
                    action: call-service
                    service: script.mise_a_jour_bobine_blanc
                - color: red
                  entity: input_number.filament_rouge_restant
                  icon: 'mdi:printer-3d-nozzle'
                  name: ' '
                  severity:
                    - from: '1'
                      to: '50'
                      icon: 'mdi:alert'
                      color: red
                    - from: '50'
                      to: '250'
                      color: red
                      icon: 'mdi:printer-3d-nozzle'
                  max: '250'
                  min: '0'
                  tap_action:
                    action: call-service
                    service: script.mise_a_jour_bobine_rouge
                - color: blue
                  entity: input_number.filament_bleu_restant
                  icon: 'mdi:printer-3d-nozzle'
                  name: ' '
                  severity:
                    - from: '1'
                      to: '50'
                      icon: 'mdi:alert'
                      color: blue
                    - from: '50'
                      to: '166'
                      color: blue
                      icon: 'mdi:printer-3d-nozzle'
                  max: '166'
                  min: '0'
                  tap_action:
                    action: call-service
                    service: script.mise_a_jour_bobine_bleu
                - color: green
                  entity: input_number.filament_vert_restant
                  icon: 'mdi:printer-3d-nozzle'
                  name: ' '
                  severity:
                    - from: '1'
                      to: '50'
                      icon: 'mdi:alert'
                      color: green
                    - from: '50'
                      to: '166'
                      color: green
                      icon: 'mdi:printer-3d-nozzle'
                  max: '166'
                  min: '0'
                  tap_action:
                    action: call-service
                    service: script.mise_a_jour_bobine_vert
                - color: yellow
                  entity: input_number.filament_jaune_restant
                  icon: 'mdi:printer-3d-nozzle'
                  name: ' '
                  severity:
                    - from: '1'
                      to: '50'
                      icon: 'mdi:alert'
                      color: yellow
                    - from: '50'
                      to: '166'
                      color: yellow
                      icon: 'mdi:printer-3d-nozzle'
                  max: '166'
                  min: '0'
                  tap_action:
                    action: call-service
                    service: script.mise_a_jour_bobine_jaune
                - color: orange
                  entity: input_number.filament_orange_restant
                  icon: 'mdi:printer-3d-nozzle'
                  name: ' '
                  severity:
                    - from: '1'
                      to: '50'
                      icon: 'mdi:alert'
                      color: orange
                    - from: '50'
                      to: '166'
                      color: orange
                      icon: 'mdi:printer-3d-nozzle'
                  max: '166'
                  min: '0'
                  tap_action:
                    action: call-service
                    service: script.mise_a_jour_bobine_orange
              height: 200px
              decimal: 0
              max: 100
              min: 0
              padding: 2px
              positions:
                icon: inside
                title: outside
                indicator: 'off'
              stack: horizontal
              style: |-
                bar-card-title {
                  text-shadow: none;
                }
                ha-icon {
                  color: white;
                } 
                bar-card-card:nth-child(1) ha-icon, ha-icon {
                  color: white;
                } 
                bar-card-value {
                  text-shadow: none;
                  color: white;
                } 
                bar-card-currentbar {
                  border-radius: 10px;
                } 
                bar-card-backgroundbar {
                  border-radius: 10px;
                }  bar-card-card:nth-child(2) bar-card-value{
                  text-shadow: none;
                  color: black;
                }  bar-card-card:nth-child(5) bar-card-value{
                  text-shadow: none;
                  color: black;
                }  bar-card-card:nth-child(6) bar-card-value{
                  text-shadow: none;
                  color: black;
                }
              type: 'custom:bar-card'
              unit_of_measurement: m
      - type: conditional
        conditions:
          - entity: sensor.Octoprint_current_state
            state: Operational
        card:
          direction: up
          entities:
            - color: black
              entity: input_number.filament_noir_restant
              icon: 'hacf:filament'
              name: ' '
              severity:
                - from: '1'
                  to: '50'
                  icon: 'mdi:alert'
                  color: black
                - from: '50'
                  to: '330'
                  color: black
                  icon: 'hacf:filament'
              max: '330'
              min: '0'
            - color: white
              entity: input_number.filament_blanc_restant
              icon: 'hacf:filament'
              name: ' '
              severity:
                - from: '1'
                  to: '50'
                  icon: 'mdi:alert'
                  color: white
                - from: '50'
                  to: '330'
                  color: white
                  icon: 'hacf:filament'
              max: '330'
              min: '0'
            - color: red
              entity: input_number.filament_rouge_restant
              icon: 'hacf:filament'
              name: ' '
              severity:
                - from: '1'
                  to: '50'
                  icon: 'mdi:alert'
                  color: red
                - from: '50'
                  to: '250'
                  color: red
                  icon: 'hacf:filament'
              max: '250'
              min: '0'
            - color: blue
              entity: input_number.filament_bleu_restant
              icon: 'hacf:filament'
              name: ' '
              severity:
                - from: '1'
                  to: '50'
                  icon: 'mdi:alert'
                  color: blue
                - from: '50'
                  to: '166'
                  color: blue
                  icon: 'hacf:filament'
              max: '166'
              min: '0'
            - color: green
              entity: input_number.filament_vert_restant
              icon: 'mdi:hacf:filament'
              name: ' '
              severity:
                - from: '1'
                  to: '50'
                  icon: 'mdi:alert'
                  color: green
                - from: '50'
                  to: '166'
                  color: green
                  icon: 'hacf:filament'
              max: '166'
              min: '0'
            - color: yellow
              entity: input_number.filament_jaune_restant
              icon: 'hacf:filament'
              name: ' '
              severity:
                - from: '1'
                  to: '50'
                  icon: 'mdi:alert'
                  color: yellow
                - from: '50'
                  to: '166'
                  color: yellow
                  icon: 'hacf:filament'
              max: '166'
              min: '0'
            - color: orange
              entity: input_number.filament_orange_restant
              icon: 'hacf:filament'
              name: ' '
              severity:
                - from: '1'
                  to: '50'
                  icon: 'mdi:alert'
                  color: orange
                - from: '50'
                  to: '166'
                  color: orange
                  icon: 'hacf:filament'
              max: '166'
              min: '0'
          height: 200px
          decimal: 0
          max: 100
          min: 0
          padding: 2px
          positions:
            icon: inside
            title: outside
            indicator: 'off'
          stack: horizontal
          style: |-
            bar-card-title {
              text-shadow: none;
            }
            ha-icon {
              color: white;
            } 
            bar-card-card:nth-child(1) ha-icon, {
              color: white;
            } 
            bar-card-value {
              text-shadow: none;
              color: white;
            } 
            bar-card-currentbar {
              border-radius: 10px;
            } 
            bar-card-backgroundbar {
              border-radius: 10px;
            } 
            bar-card-card:nth-child(2) bar-card-value{
              text-shadow: none;
              color: black;
            } 
            bar-card-card:nth-child(5) bar-card-value{
              text-shadow: none;
              color: black;
            } 
            bar-card-card:nth-child(6) bar-card-value{
              text-shadow: none;
              color: black;
            } 
          type: 'custom:bar-card'
          unit_of_measurement: m
  - type: 'custom:stack-in-card'
    cards:
      - type: conditional
        conditions:
          - entity: sensor.Octoprint_current_state
            state: Printing
        card:
          type: 'custom:stack-in-card'
          cards:
            - direction: up
              entities:
                - color: silver
                  entity: input_number.filament_argent_restant
                  icon: 'mdi:printer-3d-nozzle'
                  name: ' '
                  severity:
                    - from: '1'
                      to: '50'
                      icon: 'mdi:alert'
                      color: silver
                    - from: '50'
                      to: '166'
                      color: silver
                      icon: 'mdi:printer-3d-nozzle'
                  max: '166'
                  min: '0'
                  tap_action:
                    action: call-service
                    service: script.mise_a_jour_bobine_argent
                - color: gold
                  entity: input_number.filament_or_restant
                  icon: 'mdi:printer-3d-nozzle'
                  name: ' '
                  severity:
                    - from: '1'
                      to: '50'
                      icon: 'mdi:alert'
                      color: gold
                    - from: '50'
                      to: '166'
                      color: gold
                      icon: 'mdi:printer-3d-nozzle'
                  max: '166'
                  min: '0'
                  tap_action:
                    action: call-service
                    service: script.mise_a_jour_bobine_or
                - color: '#922724'
                  entity: input_number.filament_cuivre_restant
                  icon: 'mdi:printer-3d-nozzle'
                  name: ' '
                  severity:
                    - from: '1'
                      to: '50'
                      icon: 'mdi:alert'
                      color: '#922724'
                    - from: '50'
                      to: '166'
                      color: '#922724'
                      icon: 'mdi:printer-3d-nozzle'
                  max: '166'
                  min: '0'
                  tap_action:
                    action: call-service
                    service: script.mise_a_jour_bobine_cuivre
                - color: '#A0522D'
                  entity: input_number.filament_bois_restant
                  icon: 'mdi:printer-3d-nozzle'
                  name: ' '
                  severity:
                    - from: '1'
                      to: '50'
                      icon: 'mdi:alert'
                      color: '#A0522D'
                    - from: '50'
                      to: '166'
                      color: '#A0522D'
                      icon: 'mdi:printer-3d-nozzle'
                  max: '166'
                  min: '0'
                  tap_action:
                    action: call-service
                    service: script.mise_a_jour_bobine_bois
                - color: '#FAEBD7'
                  entity: input_number.filament_marbre_restant
                  icon: 'mdi:printer-3d-nozzle'
                  name: ' '
                  severity:
                    - from: '1'
                      to: '50'
                      icon: 'mdi:alert'
                      color: '#FAEBD7'
                    - from: '50'
                      to: '166'
                      color: '#FAEBD7'
                      icon: 'mdi:printer-3d-nozzle'
                  max: '166'
                  min: '0'
                  tap_action:
                    action: call-service
                    service: script.mise_a_jour_bobine_marbre
                - color: '#8B4513'
                  entity: input_number.filament_marron_leger_restant
                  icon: 'mdi:printer-3d-nozzle'
                  name: ' '
                  severity:
                    - from: '1'
                      to: '50'
                      icon: 'mdi:alert'
                      color: '#8B4513'
                    - from: '50'
                      to: '166'
                      color: '#8B4513'
                      icon: 'mdi:printer-3d-nozzle'
                  max: '166'
                  min: '0'
                  tap_action:
                    action: call-service
                    service: script.mise_a_jour_bobine_marron_leger
                - color: grey
                  entity: input_number.filament_gris_restant
                  icon: 'mdi:printer-3d-nozzle'
                  name: ' '
                  severity:
                    - from: '1'
                      to: '50'
                      icon: 'mdi:alert'
                      color: grey
                    - from: '50'
                      to: '166'
                      color: grey
                      icon: 'mdi:printer-3d-nozzle'
                  max: '166'
                  min: '0'
                  tap_action:
                    action: call-service
                    service: script.mise_a_jour_bobine_gris
              height: 200px
              decimal: 0
              max: 100
              min: 0
              padding: 2px
              positions:
                icon: inside
                title: outside
                indicator: 'off'
              stack: horizontal
              style: |-
                bar-card-title {
                  text-shadow: none;
                }
                ha-icon {
                  color: white;
                } 
                bar-card-card:nth-child(1) ha-icon, ha-icon {
                  color: white;
                } 
                bar-card-value {
                  text-shadow: none;
                  color: white;
                } 
                bar-card-currentbar {
                  border-radius: 10px;
                } 
                bar-card-backgroundbar {
                  border-radius: 10px;
                }  bar-card-card:nth-child(2) bar-card-value{
                  text-shadow: none;
                  color: black;
                }  bar-card-card:nth-child(5) bar-card-value{
                  text-shadow: none;
                  color: black;
                } 
              type: 'custom:bar-card'
              unit_of_measurement: m
      - type: conditional
        conditions:
          - entity: sensor.Octoprint_current_state
            state: Operational
        card:
          direction: up
          entities:
            - color: silver
              entity: input_number.filament_argent_restant
              icon: 'hacf:filament'
              name: ' '
              severity:
                - from: '1'
                  to: '50'
                  icon: 'mdi:alert'
                  color: silver
                - from: '50'
                  to: '166'
                  color: silver
                  icon: 'hacf:filament'
              max: '166'
              min: '0'
            - color: gold
              entity: input_number.filament_or_restant
              icon: 'hacf:filament'
              name: ' '
              severity:
                - from: '1'
                  to: '50'
                  icon: 'mdi:alert'
                  color: gold
                - from: '50'
                  to: '166'
                  color: gold
                  icon: 'hacf:filament'
              max: '166'
              min: '0'
            - color: '#922724'
              entity: input_number.filament_cuivre_restant
              icon: 'hacf:filament'
              name: ' '
              severity:
                - from: '1'
                  to: '50'
                  icon: 'mdi:alert'
                  color: '#922724'
                - from: '50'
                  to: '166'
                  color: '#922724'
                  icon: 'hacf:filament'
              max: '166'
              min: '0'
            - color: '#A52A2A'
              entity: input_number.filament_bois_restant
              icon: 'hacf:filament'
              name: ' '
              severity:
                - from: '1'
                  to: '50'
                  icon: 'mdi:alert'
                  color: '#A0522D'
                - from: '50'
                  to: '166'
                  color: '#A0522D'
                  icon: 'hacf:filament'
              max: '166'
              min: '0'
            - color: '#FAEBD7'
              entity: input_number.filament_marbre_restant
              icon: 'hacf:filament'
              name: ' '
              severity:
                - from: '1'
                  to: '50'
                  icon: 'mdi:alert'
                  color: '##FAEBD7'
                - from: '50'
                  to: '166'
                  color: '##FAEBD7'
                  icon: 'hacf:filament'
              max: '166'
              min: '0'
            - color: '#D2691E'
              entity: input_number.filament_marron_leger_restant
              icon: 'hacf:filament'
              name: ' '
              severity:
                - from: '1'
                  to: '50'
                  icon: 'mdi:alert'
                  color: '#D2691E'
                - from: '50'
                  to: '166'
                  color: '#D2691E'
                  icon: 'hacf:filament'
              max: '166'
              min: '0'
            - color: grey
              entity: input_number.filament_gris_restant
              icon: 'hacf:filament'
              name: ' '
              severity:
                - from: '1'
                  to: '50'
                  icon: 'mdi:alert'
                  color: grey
                - from: '50'
                  to: '166'
                  color: grey
                  icon: 'hacf:filament'
              max: '166'
              min: '0'
          height: 200px
          decimal: 0
          max: 100
          min: 0
          padding: 2px
          positions:
            icon: inside
            title: outside
            indicator: 'off'
          stack: horizontal
          style: |-
            bar-card-title {
              text-shadow: none;
            }
            ha-icon {
              color: white;
            } 
            bar-card-card:nth-child(1) ha-icon,{
              color: white;
            } 
            bar-card-value {
              text-shadow: none;
              color: white;
            } 
            bar-card-currentbar {
              border-radius: 10px;
            } 
            bar-card-backgroundbar {
              border-radius: 10px;
            } 
            bar-card-card:nth-child(2) bar-card-value{
              text-shadow: none;
              color: black;
            } 
            bar-card-card:nth-child(5) bar-card-value{
              text-shadow: none;
                color: black;
            } 
          type: 'custom:bar-card'
          unit_of_measurement: m
  - type: vertical-stack
    cards:
      - type: entities
        entities:
          - entity: input_boolean.reset_filament
            icon: 'hacf:filament'
      - type: conditional
        conditions:
          - entity: input_boolean.reset_filament
            state: 'on'
        card:
          type: entities
          entities:
            - entity: input_number.filament_noir_restant
            - entity: input_number.filament_blanc_restant
            - entity: input_number.filament_rouge_restant
            - entity: input_number.filament_bleu_restant
            - entity: input_number.filament_vert_restant
            - entity: input_number.filament_jaune_restant
            - entity: input_number.filament_orange_restant
            - entity: input_number.filament_argent_restant
            - entity: input_number.filament_or_restant
            - entity: input_number.filament_cuivre_restant
            - entity: input_number.filament_bois_restant
            - entity: input_number.filament_marbre_restant
            - entity: input_number.filament_marron_leger_restant
            - entity: input_number.filament_gris_restant
          state_color: true

Alors bien entendu à vous de choisir la condition. Ici la condition est :

        conditions:
          - entity: sensor.Octoprint_current_state
            state: Printing

Les scripts

Avec ce script, vous allez mettre à jour les input_number, qui contiennent la valeur actuelle de la quantité de vos filaments et donc seront mis à jour.
Ca fait beaucoup de scripts car il faut autant de script que de bobine en votre possession, et je commence à en avoir pas mal :

code
##################################################################################################
############################################# Bobine filament BLANC  #############################
mise_a_jour_bobine_blanc:
  alias: Mise à jour Bobine Blanche
  sequence:
    - service: input_number.set_value
      data:
        value: >
          {{ states('input_number.filament_blanc_restant')|float - states('input_number.longueur_filament')|float  }}
      target:
        entity_id: input_number.filament_blanc
    - choose:
        - conditions:
            - condition: numeric_state
              entity_id: input_number.filament_blanc_restant
              above: input_number.filament_blanc
          sequence:
            - repeat:
                while:
                  - condition: numeric_state
                    entity_id: input_number.filament_blanc_restant
                    above: input_number.filament_blanc
                sequence:
                  - service: input_number.decrement
                    target:
                      entity_id: input_number.filament_blanc_restant
                  - delay:
                      hours: 0
                      minutes: 0
                      seconds: 0
                      milliseconds: 50
            - service: input_boolean.turn_off
              target:
                entity_id: input_boolean.nouvelle_impression
        - conditions:
            - condition: numeric_state
              entity_id: input_number.filament_blanc_restant
              below: input_number.filament_blanc
          sequence:
            - repeat:
                while:
                  - condition: numeric_state
                    entity_id: input_number.filament_blanc_restant
                    below: input_number.filament_blanc
                sequence:
                  - service: input_number.increment
                    target:
                      entity_id: input_number.filament_blanc_restant
                  - delay:
                      hours: 0
                      minutes: 0
                      seconds: 0
                      milliseconds: 50
            - service: input_boolean.turn_off
              target:
                entity_id: input_boolean.nouvelle_impression
  mode: single
########################################################################################################
############################################# Bobine filament NOIR  ####################################
mise_a_jour_bobine_noir:
  alias: Mise à jour Bobine Noir
  sequence:
    - service: input_number.set_value
      data:
        value: >
          {{ states('input_number.filament_noir_restant')|float - states('input_number.longueur_filament')|float  }}
      target:
        entity_id: input_number.filament_noir
    - choose:
        - conditions:
            - condition: numeric_state
              entity_id: input_number.filament_noir_restant
              above: input_number.filament_noir
          sequence:
            - repeat:
                while:
                  - condition: numeric_state
                    entity_id: input_number.filament_noir_restant
                    above: input_number.filament_noir
                sequence:
                  - service: input_number.decrement
                    target:
                      entity_id: input_number.filament_noir_restant
                  - delay:
                      hours: 0
                      minutes: 0
                      seconds: 0
                      milliseconds: 50
            - service: input_boolean.turn_off
              target:
                entity_id: input_boolean.nouvelle_impression
        - conditions:
            - condition: numeric_state
              entity_id: input_number.filament_noir_restant
              below: input_number.filament_noir
          sequence:
            - repeat:
                while:
                  - condition: numeric_state
                    entity_id: input_number.filament_noir_restant
                    below: input_number.filament_noir
                sequence:
                  - service: input_number.increment
                    target:
                      entity_id: input_number.filament_noir_restant
                  - delay:
                      hours: 0
                      minutes: 0
                      seconds: 0
                      milliseconds: 50
            - service: input_boolean.turn_off
              target:
                entity_id: input_boolean.nouvelle_impression
  mode: single
###############################################################################################
############################################# Bobine filament BLEU  ###########################
mise_a_jour_bobine_bleu:
  alias: Mise à jour Bobine bleu
  sequence:
    - service: input_number.set_value
      data:
        value: >
          {{ states('input_number.filament_bleu_restant')|float - states('input_number.longueur_filament')|float  }}
      target:
        entity_id: input_number.filament_bleu
    - choose:
        - conditions:
            - condition: numeric_state
              entity_id: input_number.filament_bleu_restant
              above: input_number.filament_bleu
          sequence:
            - repeat:
                while:
                  - condition: numeric_state
                    entity_id: input_number.filament_bleu_restant
                    above: input_number.filament_bleu
                sequence:
                  - service: input_number.decrement
                    target:
                      entity_id: input_number.filament_bleu_restant
                  - delay:
                      hours: 0
                      minutes: 0
                      seconds: 0
                      milliseconds: 50
            - service: input_boolean.turn_off
              target:
                entity_id: input_boolean.nouvelle_impression
        - conditions:
            - condition: numeric_state
              entity_id: input_number.filament_bleu_restant
              below: input_number.filament_bleu
          sequence:
            - repeat:
                while:
                  - condition: numeric_state
                    entity_id: input_number.filament_bleu_restant
                    below: input_number.filament_bleu
                sequence:
                  - service: input_number.increment
                    target:
                      entity_id: input_number.filament_bleu_restant
                  - delay:
                      hours: 0
                      minutes: 0
                      seconds: 0
                      milliseconds: 50
            - service: input_boolean.turn_off
              target:
                entity_id: input_boolean.nouvelle_impression
  mode: single
########################################################################################
############################################# Bobine filament ROUGE  ###########################
mise_a_jour_bobine_rouge:
  alias: Mise à jour Bobine rouge
  sequence:
    - service: input_number.set_value
      data:
        value: >
          {{ states('input_number.filament_rouge_restant')|float - states('input_number.longueur_filament')|float  }}
      target:
        entity_id: input_number.filament_rouge
    - choose:
        - conditions:
            - condition: numeric_state
              entity_id: input_number.filament_rouge_restant
              above: input_number.filament_rouge
          sequence:
            - repeat:
                while:
                  - condition: numeric_state
                    entity_id: input_number.filament_rouge_restant
                    above: input_number.filament_rouge
                sequence:
                  - service: input_number.decrement
                    target:
                      entity_id: input_number.filament_rouge_restant
                  - delay:
                      hours: 0
                      minutes: 0
                      seconds: 0
                      milliseconds: 50
            - service: input_boolean.turn_off
              target:
                entity_id: input_boolean.nouvelle_impression
        - conditions:
            - condition: numeric_state
              entity_id: input_number.filament_rouge_restant
              below: input_number.filament_rouge
          sequence:
            - repeat:
                while:
                  - condition: numeric_state
                    entity_id: input_number.filament_rouge_restant
                    below: input_number.filament_rouge
                sequence:
                  - service: input_number.increment
                    target:
                      entity_id: input_number.filament_rouge_restant
                  - delay:
                      hours: 0
                      minutes: 0
                      seconds: 0
                      milliseconds: 50
            - service: input_boolean.turn_off
              target:
                entity_id: input_boolean.nouvelle_impression
  mode: single
########################################################################################
############################################# Bobine filament VERT  ###########################
mise_a_jour_bobine_vert:
  alias: Mise à jour Bobine vert
  sequence:
    - service: input_number.set_value
      data:
        value: >
          {{ states('input_number.filament_vert_restant')|float - states('input_number.longueur_filament')|float  }}
      target:
        entity_id: input_number.filament_vert
    - choose:
        - conditions:
            - condition: numeric_state
              entity_id: input_number.filament_vert_restant
              above: input_number.filament_vert
          sequence:
            - repeat:
                while:
                  - condition: numeric_state
                    entity_id: input_number.filament_vert_restant
                    above: input_number.filament_vert
                sequence:
                  - service: input_number.decrement
                    target:
                      entity_id: input_number.filament_vert_restant
                  - delay:
                      hours: 0
                      minutes: 0
                      seconds: 0
                      milliseconds: 50
            - service: input_boolean.turn_off
              target:
                entity_id: input_boolean.nouvelle_impression
        - conditions:
            - condition: numeric_state
              entity_id: input_number.filament_vert_restant
              below: input_number.filament_vert
          sequence:
            - repeat:
                while:
                  - condition: numeric_state
                    entity_id: input_number.filament_vert_restant
                    below: input_number.filament_vert
                sequence:
                  - service: input_number.increment
                    target:
                      entity_id: input_number.filament_vert_restant
                  - delay:
                      hours: 0
                      minutes: 0
                      seconds: 0
                      milliseconds: 50
            - service: input_boolean.turn_off
              target:
                entity_id: input_boolean.nouvelle_impression
  mode: single
########################################################################################
############################################# Bobine filament JAUNE  ###########################
mise_a_jour_bobine_jaune:
  alias: Mise à jour Bobine jaune
  sequence:
    - service: input_number.set_value
      data:
        value: >
          {{ states('input_number.filament_jaune_restant')|float - states('input_number.longueur_filament')|float  }}
      target:
        entity_id: input_number.filament_jaune
    - choose:
        - conditions:
            - condition: numeric_state
              entity_id: input_number.filament_jaune_restant
              above: input_number.filament_jaune
          sequence:
            - repeat:
                while:
                  - condition: numeric_state
                    entity_id: input_number.filament_jaune_restant
                    above: input_number.filament_jaune
                sequence:
                  - service: input_number.decrement
                    target:
                      entity_id: input_number.filament_jaune_restant
                  - delay:
                      hours: 0
                      minutes: 0
                      seconds: 0
                      milliseconds: 50
            - service: input_boolean.turn_off
              target:
                entity_id: input_boolean.nouvelle_impression
        - conditions:
            - condition: numeric_state
              entity_id: input_number.filament_jaune_restant
              below: input_number.filament_jaune
          sequence:
            - repeat:
                while:
                  - condition: numeric_state
                    entity_id: input_number.filament_jaune_restant
                    below: input_number.filament_jaune
                sequence:
                  - service: input_number.increment
                    target:
                      entity_id: input_number.filament_jaune_restant
                  - delay:
                      hours: 0
                      minutes: 0
                      seconds: 0
                      milliseconds: 50
            - service: input_boolean.turn_off
              target:
                entity_id: input_boolean.nouvelle_impression
  mode: single
########################################################################################
############################################# Bobine filament ORANGE  ###########################
mise_a_jour_bobine_orange:
  alias: Mise à jour Bobine orange
  sequence:
    - service: input_number.set_value
      data:
        value: >
          {{ states('input_number.filament_orange_restant')|float - states('input_number.longueur_filament')|float  }}
      target:
        entity_id: input_number.filament_orange
    - choose:
        - conditions:
            - condition: numeric_state
              entity_id: input_number.filament_orange_restant
              above: input_number.filament_orange
          sequence:
            - repeat:
                while:
                  - condition: numeric_state
                    entity_id: input_number.filament_orange_restant
                    above: input_number.filament_orange
                sequence:
                  - service: input_number.decrement
                    target:
                      entity_id: input_number.filament_orange_restant
                  - delay:
                      hours: 0
                      minutes: 0
                      seconds: 0
                      milliseconds: 50
            - service: input_boolean.turn_off
              target:
                entity_id: input_boolean.nouvelle_impression
        - conditions:
            - condition: numeric_state
              entity_id: input_number.filament_orange_restant
              below: input_number.filament_orange
          sequence:
            - repeat:
                while:
                  - condition: numeric_state
                    entity_id: input_number.filament_orange_restant
                    below: input_number.filament_orange
                sequence:
                  - service: input_number.increment
                    target:
                      entity_id: input_number.filament_orange_restant
                  - delay:
                      hours: 0
                      minutes: 0
                      seconds: 0
                      milliseconds: 50
            - service: input_boolean.turn_off
              target:
                entity_id: input_boolean.nouvelle_impression
  mode: single
########################################################################################
##################################################################################################
############################################# Bobine filament ARGENT  #############################
mise_a_jour_bobine_argent:
  alias: Mise à jour Bobine Argent
  sequence:
    - service: input_number.set_value
      data:
        value: >
          {{ states('input_number.filament_argent_restant')|float - states('input_number.longueur_filament')|float  }}
      target:
        entity_id: input_number.filament_argent
    - choose:
        - conditions:
            - condition: numeric_state
              entity_id: input_number.filament_argent_restant
              above: input_number.filament_argent
          sequence:
            - repeat:
                while:
                  - condition: numeric_state
                    entity_id: input_number.filament_argent_restant
                    above: input_number.filament_argent
                sequence:
                  - service: input_number.decrement
                    target:
                      entity_id: input_number.filament_argent_restant
                  - delay:
                      hours: 0
                      minutes: 0
                      seconds: 0
                      milliseconds: 50
            - service: input_boolean.turn_off
              target:
                entity_id: input_boolean.nouvelle_impression
        - conditions:
            - condition: numeric_state
              entity_id: input_number.filament_argent_restant
              below: input_number.filament_argent
          sequence:
            - repeat:
                while:
                  - condition: numeric_state
                    entity_id: input_number.filament_argent_restant
                    below: input_number.filament_argent
                sequence:
                  - service: input_number.increment
                    target:
                      entity_id: input_number.filament_argent_restant
                  - delay:
                      hours: 0
                      minutes: 0
                      seconds: 0
                      milliseconds: 50
            - service: input_boolean.turn_off
              target:
                entity_id: input_boolean.nouvelle_impression
  mode: single
########################################################################################################
############################################# Bobine filament OR  ####################################
mise_a_jour_bobine_or:
  alias: Mise à jour Bobine Or
  sequence:
    - service: input_number.set_value
      data:
        value: >
          {{ states('input_number.filament_or_restant')|float - states('input_number.longueur_filament')|float  }}
      target:
        entity_id: input_number.filament_or
    - choose:
        - conditions:
            - condition: numeric_state
              entity_id: input_number.filament_or_restant
              above: input_number.filament_or
          sequence:
            - repeat:
                while:
                  - condition: numeric_state
                    entity_id: input_number.filament_or_restant
                    above: input_number.filament_or
                sequence:
                  - service: input_number.decrement
                    target:
                      entity_id: input_number.filament_or_restant
                  - delay:
                      hours: 0
                      minutes: 0
                      seconds: 0
                      milliseconds: 50
            - service: input_boolean.turn_off
              target:
                entity_id: input_boolean.nouvelle_impression
        - conditions:
            - condition: numeric_state
              entity_id: input_number.filament_or_restant
              below: input_number.filament_or
          sequence:
            - repeat:
                while:
                  - condition: numeric_state
                    entity_id: input_number.filament_or_restant
                    below: input_number.filament_or
                sequence:
                  - service: input_number.increment
                    target:
                      entity_id: input_number.filament_or_restant
                  - delay:
                      hours: 0
                      minutes: 0
                      seconds: 0
                      milliseconds: 50
            - service: input_boolean.turn_off
              target:
                entity_id: input_boolean.nouvelle_impression
  mode: single
###############################################################################################
############################################# Bobine filament bois  ###########################
mise_a_jour_bobine_bois:
  alias: Mise à jour Bobine Bois
  sequence:
    - service: input_number.set_value
      data:
        value: >
          {{ states('input_number.filament_bois_restant')|float - states('input_number.longueur_filament')|float  }}
      target:
        entity_id: input_number.filament_bois
    - choose:
        - conditions:
            - condition: numeric_state
              entity_id: input_number.filament_bois_restant
              above: input_number.filament_bois
          sequence:
            - repeat:
                while:
                  - condition: numeric_state
                    entity_id: input_number.filament_bois_restant
                    above: input_number.filament_bois
                sequence:
                  - service: input_number.decrement
                    target:
                      entity_id: input_number.filament_bois_restant
                  - delay:
                      hours: 0
                      minutes: 0
                      seconds: 0
                      milliseconds: 50
            - service: input_boolean.turn_off
              target:
                entity_id: input_boolean.nouvelle_impression
        - conditions:
            - condition: numeric_state
              entity_id: input_number.filament_bois_restant
              below: input_number.filament_bois
          sequence:
            - repeat:
                while:
                  - condition: numeric_state
                    entity_id: input_number.filament_bois_restant
                    below: input_number.filament_bois
                sequence:
                  - service: input_number.increment
                    target:
                      entity_id: input_number.filament_bois_restant
                  - delay:
                      hours: 0
                      minutes: 0
                      seconds: 0
                      milliseconds: 50
            - service: input_boolean.turn_off
              target:
                entity_id: input_boolean.nouvelle_impression
  mode: single
########################################################################################
############################################# Bobine filament MARRON_LEGER  ###########################
mise_a_jour_bobine_marron_leger:
  alias: Mise à jour Bobine marron_leger
  sequence:
    - service: input_number.set_value
      data:
        value: >
          {{ states('input_number.filament_marron_leger_restant')|float - states('input_number.longueur_filament')|float  }}
      target:
        entity_id: input_number.filament_marron_leger
    - choose:
        - conditions:
            - condition: numeric_state
              entity_id: input_number.filament_marron_leger_restant
              above: input_number.filament_marron_leger
          sequence:
            - repeat:
                while:
                  - condition: numeric_state
                    entity_id: input_number.filament_marron_leger_restant
                    above: input_number.filament_marron_leger
                sequence:
                  - service: input_number.decrement
                    target:
                      entity_id: input_number.filament_marron_leger_restant
                  - delay:
                      hours: 0
                      minutes: 0
                      seconds: 0
                      milliseconds: 50
            - service: input_boolean.turn_off
              target:
                entity_id: input_boolean.nouvelle_impression
        - conditions:
            - condition: numeric_state
              entity_id: input_number.filament_marron_leger_restant
              below: input_number.filament_marron_leger
          sequence:
            - repeat:
                while:
                  - condition: numeric_state
                    entity_id: input_number.filament_marron_leger_restant
                    below: input_number.filament_marron_leger
                sequence:
                  - service: input_number.increment
                    target:
                      entity_id: input_number.filament_marron_leger_restant
                  - delay:
                      hours: 0
                      minutes: 0
                      seconds: 0
                      milliseconds: 50
            - service: input_boolean.turn_off
              target:
                entity_id: input_boolean.nouvelle_impression
  mode: single
########################################################################################
############################################# Bobine filament MARBRE  ###########################
mise_a_jour_bobine_marbre:
  alias: Mise à jour Bobine marbre
  sequence:
    - service: input_number.set_value
      data:
        value: >
          {{ states('input_number.filament_marbre_restant')|float - states('input_number.longueur_filament')|float  }}
      target:
        entity_id: input_number.filament_marbre
    - choose:
        - conditions:
            - condition: numeric_state
              entity_id: input_number.filament_marbre_restant
              above: input_number.filament_marbre
          sequence:
            - repeat:
                while:
                  - condition: numeric_state
                    entity_id: input_number.filament_marbre_restant
                    above: input_number.filament_marbre
                sequence:
                  - service: input_number.decrement
                    target:
                      entity_id: input_number.filament_marbre_restant
                  - delay:
                      hours: 0
                      minutes: 0
                      seconds: 0
                      milliseconds: 50
            - service: input_boolean.turn_off
              target:
                entity_id: input_boolean.nouvelle_impression
        - conditions:
            - condition: numeric_state
              entity_id: input_number.filament_marbre_restant
              below: input_number.filament_marbre
          sequence:
            - repeat:
                while:
                  - condition: numeric_state
                    entity_id: input_number.filament_marbre_restant
                    below: input_number.filament_marbre
                sequence:
                  - service: input_number.increment
                    target:
                      entity_id: input_number.filament_marbre_restant
                  - delay:
                      hours: 0
                      minutes: 0
                      seconds: 0
                      milliseconds: 50
            - service: input_boolean.turn_off
              target:
                entity_id: input_boolean.nouvelle_impression
  mode: single
########################################################################################
############################################# Bobine filament GRIS  ###########################
mise_a_jour_bobine_gris:
  alias: Mise à jour Bobine gris
  sequence:
    - service: input_number.set_value
      data:
        value: >
          {{ states('input_number.filament_gris_restant')|float - states('input_number.longueur_filament')|float  }}
      target:
        entity_id: input_number.filament_gris
    - choose:
        - conditions:
            - condition: numeric_state
              entity_id: input_number.filament_gris_restant
              above: input_number.filament_gris
          sequence:
            - repeat:
                while:
                  - condition: numeric_state
                    entity_id: input_number.filament_gris_restant
                    above: input_number.filament_gris
                sequence:
                  - service: input_number.decrement
                    target:
                      entity_id: input_number.filament_gris_restant
                  - delay:
                      hours: 0
                      minutes: 0
                      seconds: 0
                      milliseconds: 50
            - service: input_boolean.turn_off
              target:
                entity_id: input_boolean.nouvelle_impression
        - conditions:
            - condition: numeric_state
              entity_id: input_number.filament_gris_restant
              below: input_number.filament_gris
          sequence:
            - repeat:
                while:
                  - condition: numeric_state
                    entity_id: input_number.filament_gris_restant
                    below: input_number.filament_gris
                sequence:
                  - service: input_number.increment
                    target:
                      entity_id: input_number.filament_gris_restant
                  - delay:
                      hours: 0
                      minutes: 0
                      seconds: 0
                      milliseconds: 50
            - service: input_boolean.turn_off
              target:
                entity_id: input_boolean.nouvelle_impression
  mode: single
########################################################################################
############################################# Bobine filament cuivre  ###########################
mise_a_jour_bobine_cuivre:
  alias: Mise à jour Bobine cuivre
  sequence:
    - service: input_number.set_value
      data:
        value: >
          {{ states('input_number.filament_cuivre_restant')|float - states('input_number.longueur_filament')|float  }}
      target:
        entity_id: input_number.filament_cuivre
    - choose:
        - conditions:
            - condition: numeric_state
              entity_id: input_number.filament_cuivre_restant
              above: input_number.filament_cuivre
          sequence:
            - repeat:
                while:
                  - condition: numeric_state
                    entity_id: input_number.filament_cuivre_restant
                    above: input_number.filament_cuivre
                sequence:
                  - service: input_number.decrement
                    target:
                      entity_id: input_number.filament_cuivre_restant
                  - delay:
                      hours: 0
                      minutes: 0
                      seconds: 0
                      milliseconds: 50
            - service: input_boolean.turn_off
              target:
                entity_id: input_boolean.nouvelle_impression
        - conditions:
            - condition: numeric_state
              entity_id: input_number.filament_cuivre_restant
              below: input_number.filament_cuivre
          sequence:
            - repeat:
                while:
                  - condition: numeric_state
                    entity_id: input_number.filament_cuivre_restant
                    below: input_number.filament_cuivre
                sequence:
                  - service: input_number.increment
                    target:
                      entity_id: input_number.filament_cuivre_restant
                  - delay:
                      hours: 0
                      minutes: 0
                      seconds: 0
                      milliseconds: 50
            - service: input_boolean.turn_off
              target:
                entity_id: input_boolean.nouvelle_impression
  mode: single
########################################################################################

Les input_boolean

Pour faire apparaitre les cartes conditional (la carte qui apparait lorsque l’impression est detectée et la carte Reset Filament)

code
# Input boolean impression 3D
  nouvelle_impression:
    name: Nouvelle impression 3D
    icon: mdi:printer-3D
    
# Input boolean reset filament
  reset_filament:
    name: Reset Filament
    icon: mdi:ubisoft

Les input_number

/!\ C’est ici que vous allez définir le niveau minimal de vos bobines. Donc pas de surprise, c’est 0 et le niveau de longueur maximal qui dépendra de votre bobine, ainsi que la marque et le poid (1kg, 750g, 500, 250g…).

Pour connaître la longueure maximale d’une bobine c’est assez simple, soit c’est indiqué sur l’etiquette de la bobine ou son emballage, soit votre amis google est là :

1kg de filament = 330m

image

et aussi ce convertisseur poids/longueur qui prend en compte la matière (PLA, ABS…) et la densité du filament.

/!\ Vérifier avant tout l’étiquette /!\

code
##############  Gestion des filaments dans lovelace    #################
  longueur_filament:
   min: 0
   max: 330

  filament_blanc:
   min: 0
   max: 330

  filament_blanc_restant:
   min: 0
   max: 330
  
  filament_noir:
   min: 0
   max: 330

  filament_noir_restant:
   min: 0
   max: 330

  filament_rouge:
   min: 0
   max: 250

  filament_rouge_restant:
   min: 0
   max: 250
   
  filament_bleu:
   min: 0
   max: 166

  filament_bleu_restant:
   min: 0
   max: 166

  filament_jaune:
   min: 0
   max: 166

  filament_jaune_restant:
   min: 0
   max: 166

  filament_orange:
   min: 0
   max: 166
   
  filament_orange_restant:
   min: 0
   max: 166
   
  filament_vert:
   min: 0
   max: 166

  filament_vert_restant:
   min: 0
   max: 166
   
  filament_argent:
   min: 0
   max: 335

  filament_argent_restant:
   min: 0
   max: 335

  filament_or:
   min: 0
   max: 335

  filament_or_restant:
   min: 0
   max: 335

  filament_bois:
   min: 0
   max: 166

  filament_bois_restant:
   min: 0
   max: 166
   
  filament_marron_leger:
   min: 0
   max: 330

  filament_marron_leger_restant:
   min: 0
   max: 330

  filament_marbre:
   min: 0
   max: 330

  filament_marbre_restant:
   min: 0
   max: 330

  filament_gris:
   min: 0
   max: 330

  filament_gris_restant:
   min: 0
   max: 330

  filament_cuivre:
   min: 0
   max: 335

  filament_cuivre_restant:
   min: 0
   max: 335

##############################################################   

Limite de filament et telegram

Vous pouvez définir deux alertes (voir plus) :

  • la première étant le changement d’icône de la carte précédente. Vous avez vu sur le gif le panneau triangle de la bobine noire
  • et la seconde est une notification Telegram via Node-RED.

Dans le code de la carte vous avez remarqué ceci :

image

Où j’indique que le filament restant entre 50 et 250 affichera l’icône nozzle. En revanche si la longueur du filament se situe entre 50 et 1 l’icone /!\ apparaitra.

Voici le flow Node-RED pour le recevoir sur Telegram (à adapter pour votre système de notification préféré) :

image

image

image

dans le data du noeud :

{ "message": "Le niveau du filament noir est de {{states('input_number.filament_noir_restant')}}m" }

les pro de Node-RED feront sûrement mieux, mais sinon il faudra multiplier ce flow pour chaque filament.

image

Je reçois bien la notification Telegram :

image

Reset des filaments

Avec le code de la carte précédente et son attribut input_boolean.reset_filament vous devriez pouvoir cliquer sur le petit interrupteur et voir les input_number.filament_xxxx restant.

Si je change de bobine donc voici ce que cela donne :

2

Automatisation

bah parcequ’il en faut bien une, déjà, et puis je ne vous en dirais pas plus dessus, je ne sais plus si elle est necessaire ou si elle vient de mes test…désolé pour ce manque de serieux LOL :

  - platform: state
    entity_id: sensor.longueur_filament
  condition: []
  action:
  - service: input_number.set_value
    target:
      entity_id: input_number.longueur_filament
    data:
      value: '{{states(''sensor.longueur_filament'')|float}}'
  mode: single

Carte de contrôle

Cette carte est pour la retractation complète du filament, la visu de la camera , le contrôle de la température et de l’humidité de la boite des filaments.

3

dans le code de cette carte vous aurez donc :

  • le Nozzle Off pour arrêter la chauffe du nozzle (au cas où…),
  • le Nozzle 220 pour chauffer le nozzle à 220 au cas où,
  • l’icône Retract pour retirer le filament entièrement dans le cas d’un changement de filament. ATTENTION, je reviendrais sur le pourquoi et le comment de l’existence de cette icône),
  • AutoHome … bah, juste faire un autome home lol

Les icônes de Nozzle Off, Nozzle 220 et AutoHome ont aussi pour but de vous faire comprendre comment envoyer des Gcode à travers une carte :slight_smile:

  • l’image de la camera
  • et les sensors de température et de consommation electrique.
le code de la carte:
type: vertical-stack
cards:
  - type: horizontal-stack
    cards:
      - type: button
        name: Nozzle Off
        icon: 'mdi:printer-3d-nozzle'
        tap_action:
          action: call-service
          service: mqtt.publish
          service_data:
            topic: octoPrint/hassControl/commands
            payload: M104 S0
          target: {}
      - type: button
        name: Nozzle 220
        icon: 'mdi:printer-3d-nozzle'
        tap_action:
          action: call-service
          service: mqtt.publish
          service_data:
            topic: octoPrint/hassControl/commands
            payload: M104 S220
      - type: button
        icon: 'hacf:filament'
        hold_action:
          action: none
        tap_action:
          action: call-service
          service: input_boolean.turn_on
          service_data:
            entity_id: input_boolean.ender_retract
        name: Retract
        entity: input_boolean.ender_retract
      - type: button
        icon: 'hacf:axes'
        name: AutoHome
        tap_action:
          action: call-service
          service: mqtt.publish
          service_data:
            topic: octoPrint/hassControl/home
            payload: '["x", "y", "z"]'
  - type: picture-entity
    entity: camera.Octoprint
    show_name: false
    show_state: false
    hold_action:
      action: none
    tap_action:
      action: none
    camera_view: live
  - type: 'custom:swipe-card'
    card_width: 225px
    start_card: 2
    parameters:
      effect: coverflow
      grabCursor: true
      centeredSlides: true
      slidesPerView: auto
      coverflowEffect:
        rotate: 50
        stretch: 0
        depth: 100
        modifier: 1
        slideShadows: true
      pagination:
        type: bullets
    cards:
      - type: 'custom:mini-graph-card'
        align_icon: left
        color_thresholds:
          - color: '#1da4f2'
            value: 16
          - color: '#11f13a'
            value: 18
          - color: '#f0da11'
            value: 20
          - color: '#ef5a0f'
            value: 22
          - color: '#ef1d0f'
            value: 23
        entities:
          - sensor.temperature_laiterie
        hour24: true
        line_color: '#1da4f2'
        more_info: false
        name: Box
        points_per_hour: 1.5
        show:
          labels: true
          name: true
        line_width: 4
      - type: 'custom:mini-graph-card'
        align_icon: left
        color_thresholds:
          - color: '#1da4f2'
            value: 16
          - color: '#11f13a'
            value: 30
          - color: '#f0da11'
            value: 40
          - color: '#ef5a0f'
            value: 50
          - color: '#ef1d0f'
            value: 60
        entities:
          - sensor.humidity_laiterie
        hour24: true
        line_color: '#1da4f2'
        more_info: false
        name: Box
        points_per_hour: 1.5
        show:
          labels: true
          name: true
        line_width: 4
      - type: 'custom:mini-graph-card'
        align_icon: left
        color_thresholds:
          - color: '#1da4f2'
            value: 1
          - color: '#11f13a'
            value: 5
          - color: '#f0da11'
            value: 9
          - color: '#ef5a0f'
            value: 13
          - color: '#ef1d0f'
            value: 20
        entities:
          - sensor.tplink_ender3v2_watts
        icon: 'mdi:flash'
        hour24: true
        line_color: '#1da4f2'
        more_info: false
        name: Conso
        points_per_hour: 1.5
        show:
          labels: true
          name: true
        line_width: 4
      - type: 'custom:mini-graph-card'
        align_icon: left
        color_thresholds:
          - color: '#1da4f2'
            value: 1
          - color: '#11f13a'
            value: 10
          - color: '#f0da11'
            value: 20
          - color: '#ef5a0f'
            value: 40
          - color: '#ef1d0f'
            value: 50
        entities:
          - sensor.tplink_ender3v2_kwh
        icon: 'mdi:flash'
        hour24: true
        line_color: '#1da4f2'
        more_info: false
        name: Conso Jour
        points_per_hour: 1.5
        show:
          labels: true
          name: true
        line_width: 4

  • le Nozzle Off : je ne reviendrais pas dessus, puisqu’il envoie en mqtt l’arret de chauffe du nozzle
  • le Nozzle 220 : bah un pareil, il envoie le gcode pour que le nozzle chauffe à 220
  • Camera :, on a vu l’integration de la camera plus haut, la carte vous donne le code ^^ facile, copier coller :slight_smile:
  • AutoHome : toujours pareil, tout est dans le code pour envoyer un AutoHome à votre imprimante e Gcode, rien à dire de plus :slight_smile:
  • consommation electrique : Vous verrez dans la carte que j’utilise les sensors sensor.tplink_ender3v2_watts et sensor.tplink_ender3v2_kwh voici les codes pour créer ces sensors et d’autres :slight_smile:
le code TP LINK:
#######################################################################        
####################          Tp-Link Ender 3v2       ####################
#######################################################################  
- platform: template
    sensors:
    tplink_ender3v2_amps:
        friendly_name_template: "{{ states.switch.tplink_ender3v2.name}} tplink_ender3v2_Ampère"
        value_template: '{{ states.switch.tplink_ender3v2.attributes["current_a"] | float }}'
        unit_of_measurement: 'A'
    tplink_ender3v2_watts:
        friendly_name_template: "{{ states.switch.tplink_ender3v2.name}} tplink_ender3v2_Consommation_Actuelle"
        value_template: '{{ states.switch.tplink_ender3v2.attributes["current_power_w"] | float }}'
        unit_of_measurement: 'W'
    tplink_ender3v2_total_kwh:
        friendly_name_template: "{{ states.switch.tplink_ender3v2.name}} tplink_ender3v2_Consommation_Totale"
        value_template: '{{ states.switch.tplink_ender3v2.attributes["total_energy_kwh"] | float }}'
        unit_of_measurement: 'kWh'
    tplink_ender3v2_volts:
        friendly_name_template: "{{ states.switch.tplink_ender3v2.name}} tplink_ender3v2_Voltage"
        value_template: '{{ states.switch.tplink_ender3v2.attributes["voltage"] | float }}'
        unit_of_measurement: 'V'
    tplink_ender3v2_kwh:
        friendly_name_template: "{{ states.switch.tplink_ender3v2.name}} tplink_ender3v2_Consommation_Journalière"
        value_template: '{{ states.switch.tplink_ender3v2.attributes["today_energy_kwh"] | float }}'
        unit_of_measurement: 'kWh'
  • Retract :pourquoi prévoir une automatisation, un flow, pour retirer le filament …

Dans la vie de tous les jours vous imprimez certes des stl sympas et tout et tout. Quand vous voulez changer la couleur d’un filament pour une autre couleur de filament parcequ’il s’agit un nouveau print, vous devez vous rendre devant l’imprimante, faire un PreHeat PLA avec un disable stepper, attendre la température adequat (2mn environ), tourner la molette de l’extrudeur x tours (beaucoup de tours) et enfin insérer le nouveau filament !

Ici j’ai préféré l’automatiser au maximum, déjà parceque je suis un peu feignant et que l’imprimante est loin, mais aussi parcequ’il y a des marches à gravir donc je n’ai pas envie de faire des allez retours ou de poireauter devant inutillement.

Le processus est plutot simple à travers un flow Node-RED (vous pouvez aussi le faire avec des automatisations HA et des macro gcode !), il s’agit de :

  • Faire chauffer le nozzle avec M109 S220
  • un set position avec le gcode G92 E0
  • faire un peu d’extrusion de filament pour éviter un éventuel bouchon avec G1 E3 F100
  • et enfin faire retirer le filament avec G1 E-100 F2500000

Ainsi, en ayant cliqué juste sur le bouton Retract vous aurez fait toutes ces étapes sans vous déplacer.
(si certains pro du gcode veulent améliorer le processus, qu’ils n’hésitent pas :slight_smile: surtout si vous voyez une erreur, l’idéal serait d’utiliser une macro Gcode, mais je ne sais pas faire)

Bien entendu, ameliorez le à votre goût et votre convenance. Vous pouvez rajouter une notification à la fin, programmer un arrêt automatique de la machine si elle est non utilisée depuis 10 mn, etc etc… à partir de ce flow, faite ce que vous voulez :slight_smile:

Créer un input boolean dans HA, c’est lui qui fera la liaison entre l’icône dans HA et votre Node-RED :

créer un flow dans Node red :

Vous pouvez importer ce flow déjà tout prêt :

[{"id":"ca0807b9.758978","type":"server-state-changed","z":"12ea303a.be52b","name":"InputBoolean Ender retract","server":"a537137.2d98df","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_boolean.ender_retract","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":130,"y":3380,"wires":[["d38f4d08.1bf98","6cfc26ee.56d218"],[]]},{"id":"26994b6a.205844","type":"comment","z":"12ea303a.be52b","name":"lancement du input boulean via HA","info":"","x":160,"y":3320,"wires":[]},{"id":"3c8487a0.eef5d8","type":"api-call-service","z":"12ea303a.be52b","name":"OFF input_boolean.ender_retract","server":"a537137.2d98df","version":1,"debugenabled":false,"service_domain":"input_boolean","service":"turn_off","entityId":"input_boolean.ender_retract","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":540,"y":3440,"wires":[[]]},{"id":"6cfc26ee.56d218","type":"stoptimer","z":"12ea303a.be52b","duration":"15","units":"Second","payloadtype":"num","payloadval":"0","name":"15 sec","x":310,"y":3440,"wires":[["3c8487a0.eef5d8"],[]]},{"id":"d38f4d08.1bf98","type":"api-call-service","z":"12ea303a.be52b","name":"nozzle 200","server":"a537137.2d98df","version":1,"debugenabled":false,"service_domain":"mqtt","service":"publish","entityId":"","data":"{\"topic\":\"octoPrint/hassControl/commands\",\"payload\":\"M104 S220\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":370,"y":3360,"wires":[["1055dde6.a2b102"]]},{"id":"6271721.d4c6a8c","type":"api-call-service","z":"12ea303a.be52b","name":" Stepper Position G92 E0","server":"a537137.2d98df","version":1,"debugenabled":false,"service_domain":"mqtt","service":"publish","entityId":"","data":"{\"topic\":\"octoPrint/hassControl/commands\",\"payload\":\"G92 E0\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":830,"y":3360,"wires":[["191119ba.dae846"]]},{"id":"191119ba.dae846","type":"api-call-service","z":"12ea303a.be52b","name":"Extrusion","server":"a537137.2d98df","version":1,"debugenabled":false,"service_domain":"mqtt","service":"publish","entityId":"","data":"{\"topic\":\"octoPrint/hassControl/commands\",\"payload\":\"G1 E3 F100\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1000,"y":3280,"wires":[["7c854e8e.38336"]]},{"id":"2008d50a.c3e9aa","type":"api-call-service","z":"12ea303a.be52b","name":"Ejection du filament","server":"a537137.2d98df","version":1,"debugenabled":false,"service_domain":"mqtt","service":"publish","entityId":"","data":"{\"topic\":\"octoPrint/hassControl/commands\",\"payload\":\"G1 E-100 F2500000\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1270,"y":3280,"wires":[[]]},{"id":"7c854e8e.38336","type":"delay","z":"12ea303a.be52b","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1100,"y":3360,"wires":[["2008d50a.c3e9aa"]]},{"id":"5946299d.254898","type":"api-current-state","z":"12ea303a.be52b","name":"Nozzle à 220","server":"a537137.2d98df","version":1,"outputs":2,"halt_if":"218.99","halt_if_type":"num","halt_if_compare":"gte","override_topic":false,"entity_id":"sensor.Octoprint_tool_0_temperature","state_type":"num","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":670,"y":3280,"wires":[["6271721.d4c6a8c"],[]]},{"id":"1055dde6.a2b102","type":"stoptimer","z":"12ea303a.be52b","duration":"150","units":"Second","payloadtype":"num","payloadval":"0","name":"2.30mn","x":540,"y":3360,"wires":[["5946299d.254898"],[]]},{"id":"a537137.2d98df","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

Le noeud OFF input boolean est normal; si on ne l’arrête pas il continuera de tourner en boucle…

Le noeud stop timer de 2:30 permet au nozzle d’arriver à la température souhaitée.

Le noeud Current State permet de vérifier que le nozzle soit bien à une température supérieure à 219°, puisque la demande de chauffe du nozzle se fait par le noeud call service via mqtt au debut du flow (si j’ai une probleme quelconque, il serait dommageable de procéder à l’extrusion et au retrait si le nozzle n’est pas à la température requise). Bref, ça fait une petite securité supplémentaire.

Je penses que nos piliers de Node-RED de notre communauté HACF (@fredarro @golfvert @SNoof and co…) pourront surement améliorer tout celà :slight_smile:

Gestion Node-RED d’arrêt TPLINK + gestion des led avec WLED + photo du print envoyé sur Telegram

  1. le premier flow allume les 2 rubans de led quand la prise TPLINK est allumée (pour rappel la prise TPLINK allume l’imprimante). Les deux rubans sont controlés par un weemos D1 mini et intégrés à HA avec l’integration WLED.
  2. Le deuxieme flow allume les led quand l’imprimante imprime (nécessaire pour la suite puisque lorsqu’un travail d’impression se termine, les led clignotent façon guirlande de noël, donc si j’imprime quelqule chose d’autre à la suite, elle doivent s’arrêter de clignoter et reprendre un éclairage normal :slight_smile: )
  3. Troisième flow, à la fin de l’impression, les led clignotent façon guirlande. Une photo .jpg est prise (snapshot) grâce à la caméra, enregistrée sur le répertoire /media/ de HA, envoyée sur Telegram, puis supprimée du répertoire /media/ d’HA.
  4. quatrieme flow, à la fin de l’impression, 20 mn après, une fois que le nozzle et le bed ont refroidit, l’imprimante s’éteint grâce à la prise TPLINK. Les 2 rubans de led s’éteignent également. Pourquoi 20 mn ? pour me laisser le temps de relancer une impression ou de changer le filament par exemple.
[{"id":"64782d6c.9c5e64","type":"group","z":"12ea303a.be52b","name":"Apres 20 minutes fin de l'impression","style":{"label":true},"nodes":["2245ba88.822e46","fa6b06fe.f0cc78","a16d390b.2b7b78","76c88719.f80c88","f31645f2.60f188"],"x":94,"y":599,"w":552,"h":202},{"id":"2245ba88.822e46","type":"server-state-changed","z":"12ea303a.be52b","g":"64782d6c.9c5e64","name":"Octoprint Job percentage","server":"a537137.2d98df","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.Octoprint_job_percentage","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"100.0","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"20","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":230,"y":660,"wires":[["fa6b06fe.f0cc78","a16d390b.2b7b78","76c88719.f80c88"],[]]},{"id":"fa6b06fe.f0cc78","type":"api-call-service","z":"12ea303a.be52b","g":"64782d6c.9c5e64","name":"wled_ender","server":"a537137.2d98df","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.wled_ender","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":490,"y":640,"wires":[[]]},{"id":"a16d390b.2b7b78","type":"api-call-service","z":"12ea303a.be52b","g":"64782d6c.9c5e64","name":"wled_ender_2","server":"a537137.2d98df","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.wled_ender_2","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":500,"y":700,"wires":[[]]},{"id":"76c88719.f80c88","type":"api-call-service","z":"12ea303a.be52b","g":"64782d6c.9c5e64","name":"switch.tplink_ender3v2","server":"a537137.2d98df","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.tplink_ender3v2","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":520,"y":760,"wires":[[]]},{"id":"f31645f2.60f188","type":"inject","z":"12ea303a.be52b","g":"64782d6c.9c5e64","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":280,"y":740,"wires":[["76c88719.f80c88"]]},{"id":"a537137.2d98df","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true},{"id":"7640814c.07d2b","type":"group","z":"12ea303a.be52b","name":"allumage des led quand TPLINK Ender est allumée","style":{"label":true},"nodes":["4595d077.e2f6b","973476ad.eade38","d0315167.51753","730fcba7.418bb4"],"x":94,"y":19,"w":732,"h":202},{"id":"4595d077.e2f6b","type":"api-call-service","z":"12ea303a.be52b","g":"7640814c.07d2b","name":"ON wled_ender","server":"a537137.2d98df","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.wled_ender","data":"{\"brightness\":\"250\",\"effect\":\"Solid\",\"rgb_color\":[255,255,255]}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":600,"y":60,"wires":[[]]},{"id":"973476ad.eade38","type":"api-call-service","z":"12ea303a.be52b","g":"7640814c.07d2b","name":"ON wled_ender_2","server":"a537137.2d98df","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.wled_ender_2","data":"{\"brightness\":\"5\",\"effect\":\"Solid\",\"rgb_color\":[255,255,255]}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":610,"y":120,"wires":[[]]},{"id":"d0315167.51753","type":"api-call-service","z":"12ea303a.be52b","g":"7640814c.07d2b","name":"OFF wled_ender et wled_ender_2","server":"a537137.2d98df","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.wled_ender, light.wled_ender_2","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":660,"y":180,"wires":[[]]},{"id":"730fcba7.418bb4","type":"server-state-changed","z":"12ea303a.be52b","g":"7640814c.07d2b","name":"switch TPLINK ENDER est ON","server":"a537137.2d98df","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"switch.tplink_ender3v2","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":250,"y":100,"wires":[["4595d077.e2f6b","973476ad.eade38"],["d0315167.51753"]]},{"id":"a8c7f472.b7c7c8","type":"group","z":"12ea303a.be52b","name":"allumage des led quand Ender imprime","style":{"label":true},"nodes":["5d312f2b.e5a4d","90585fa.dd430a","8908f63a.a20f98"],"x":94,"y":239,"w":632,"h":142},{"id":"5d312f2b.e5a4d","type":"api-call-service","z":"12ea303a.be52b","g":"a8c7f472.b7c7c8","name":"ON wled_ender","server":"a537137.2d98df","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.wled_ender","data":"{\"brightness\":\"250\",\"effect\":\"Solid\",\"rgb_color\":[255,255,255]}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":600,"y":280,"wires":[[]]},{"id":"90585fa.dd430a","type":"api-call-service","z":"12ea303a.be52b","g":"a8c7f472.b7c7c8","name":"ON wled_ender_2","server":"a537137.2d98df","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.wled_ender_2","data":"{\"brightness\":\"5\",\"effect\":\"Solid\",\"rgb_color\":[255,255,255]}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":610,"y":340,"wires":[[]]},{"id":"8908f63a.a20f98","type":"server-state-changed","z":"12ea303a.be52b","g":"a8c7f472.b7c7c8","name":"Ender Printing","server":"a537137.2d98df","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.Octoprint_current_state","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"Printing","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":190,"y":320,"wires":[["5d312f2b.e5a4d","90585fa.dd430a"],[]]},{"id":"e138f350.54222","type":"group","z":"12ea303a.be52b","name":"fin de l'impression","style":{"label":true},"nodes":["c5b533c.f11cbd","7c1c43e9.09dfbc","6a058de5.c20164","d9cb0a9d.7059a8","f02b0487.db8948","c4eff3af.57827","f6ac0ba2.1bace8","3ad65c83.0fe0a4","8d5f317e.ac41a"],"x":94,"y":419,"w":1232,"h":142},{"id":"c5b533c.f11cbd","type":"server-state-changed","z":"12ea303a.be52b","g":"e138f350.54222","name":"Octoprint Job percentage","server":"a537137.2d98df","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.Octoprint_job_percentage","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"100.0","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":230,"y":460,"wires":[["7c1c43e9.09dfbc","6a058de5.c20164"],[]]},{"id":"7c1c43e9.09dfbc","type":"api-call-service","z":"12ea303a.be52b","g":"e138f350.54222","name":"WLED_ender","server":"a537137.2d98df","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.wled_ender","data":"{\"brightness\":\"250\",\"effect\":\"Sinelon Rainbow\",\"rgb_color\":[255,255,255]}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":460,"y":520,"wires":[[]]},{"id":"6a058de5.c20164","type":"change","z":"12ea303a.be52b","g":"e138f350.54222","name":"Set file","rules":[{"t":"set","p":"photo","pt":"flow","to":"'Photo_' & $fromMillis($toMillis($now()),'[M02]_[D02]_[H02]_[m02]_[s02]') & '.jpg'","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":460,"wires":[["d9cb0a9d.7059a8"]]},{"id":"d9cb0a9d.7059a8","type":"api-call-service","z":"12ea303a.be52b","g":"e138f350.54222","name":"camera_Octoprint","server":"a537137.2d98df","version":1,"debugenabled":true,"service_domain":"camera","service":"snapshot","entityId":"camera.Octoprint","data":"{\t   \"filename\": \"/media/$flowContext('photo')\"\t}","dataType":"jsonata","mergecontext":"","output_location":"photo","output_location_type":"flow","mustacheAltTags":true,"x":610,"y":460,"wires":[["f02b0487.db8948"]]},{"id":"f02b0487.db8948","type":"delay","z":"12ea303a.be52b","g":"e138f350.54222","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":740,"y":520,"wires":[["c4eff3af.57827"]]},{"id":"c4eff3af.57827","type":"api-call-service","z":"12ea303a.be52b","g":"e138f350.54222","name":"Telegram","server":"a537137.2d98df","version":1,"debugenabled":true,"service_domain":"telegram_bot","service":"send_photo","entityId":"","data":"{\t   \"file\": \"/media/$flowContext('photo')\",\t   \"caption\": \"Impression 3D\",\t   \"target\": \"-381xxxxxx\"\t}","dataType":"jsonata","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":true,"x":860,"y":460,"wires":[["f6ac0ba2.1bace8"]]},{"id":"f6ac0ba2.1bace8","type":"delay","z":"12ea303a.be52b","g":"e138f350.54222","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":960,"y":520,"wires":[["3ad65c83.0fe0a4"]]},{"id":"3ad65c83.0fe0a4","type":"change","z":"12ea303a.be52b","g":"e138f350.54222","name":"Filename","rules":[{"t":"set","p":"filename","pt":"msg","to":"photo","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":1060,"y":460,"wires":[["8d5f317e.ac41a"]]},{"id":"8d5f317e.ac41a","type":"file","z":"12ea303a.be52b","g":"e138f350.54222","name":"Delete photo","filename":"/media/$flowContext('photo')","appendNewline":true,"createDir":false,"overwriteFile":"delete","encoding":"none","x":1230,"y":460,"wires":[[]]}]

Autres

Ecran tactile Nextion

Je vous laisse avec le lien des videos de @DcJona sur l’écran Nextion (qui explique assez bien la configuration d’un Weemos D1 avec l’écran tactile et un exemple d’utilisation ). Voici mon fichier de Nextion Editor pour un ecran de 2.4 pouces :
Fichiers Nextion (avec les PSD, HDI…)

Support ruban led pour vos timelaps

Il faut 2 bouts de 10 led environ, et weemos
Ender 3 LED channel for 10mm LED strip (e.g. WS2812B) by tomikazi - Thingiverse
LED holder for x-axis ender3 by xl_bk - Thingiverse

sources de travail

carte gestion filaments
icones personnalisés vu dans mes screenshot
integration Octoprint et mqtt
Créer une entité à partir d’un topic MQTT
recherche sur le GCode
Bible du Gcode
Autre fil de discussion sur le Gcode
Flash de la Ender de JSTECH

Remerciements

@Clemalex
@Babidi ou @BenGamin sur lesimprimantes3d.fr
@papaone sur lesimprimantes3d.fr
@golfvert
@DcJona pour ses videos
sites HACF et Les imprimantes 3D .fr

Screen en vrac

3


14 « J'aime »

Merci pour ce tuto !
C’est top, très complet et clair :wink:

J’ai hâte de recevoir mon imprimante pour mettre tout cela en place, c’est exactement ce que je cherchais !
Avec ton tuto l’attente va me paraitre encore plus longue :cry:

1 « J'aime »

Très bonne réalisation ! Bravo à toi !

1 « J'aime »

je rajoute un lien vers lesimprimantes3D.fr
et une video de présentation à la fin du tuto

superbe tuto et réalisation !

1 « J'aime »

Je viens de faire ce tuto aux 3/4 et tout est nickel ! Merci Jybi pour ce tuto et les quelques coups demains en MP ! Je n’ai pas encore intégré la partie telegram et 2éme notif, ce sera pour plus tard au besoin…

1 « J'aime »

Waouh, impressionnant et j’imagine pas mal de temps passé pour arriver à ce résultat. Merci pour le partage !! De belles sources d’inspiration pour mon ender 3 pro.

1 « J'aime »

Merci pour le tuto! Dès que je reçois ma nouvelle hotend je met en place ton intégration :).
C’est top de n’avoir qu’une seule place pour tout gérer.

1 « J'aime »

Pour information il y a une card lovelace pour octoprint

voici l’url :

Pour l’installation utiliser HACS :

  1. aller sur HACS et sélectionner Frontend
  2. ouvrer le menu en haut a droite (⋮) et sélectionner Custom repositories
  3. Coller l’url suivante https://github.com/dangreco/threedy dans « input field » et sélectionner Lovelace dans le menu deroulant
  4. Cliquer sur le boutton « Install »

Ajouter la nouvelle carte a votre dashboard lovelace. Voici la configuration par lovelace en mode graphique :

voici un petit rendu de la carte une fois configuré :

Rendu_card_octoprint

4 « J'aime »

Impressionnant.
De mon côté, j’ai pas d’info mqqt qui remonte. Je vois les autres infos mais pas celles ci

Je vois pas où ça bug…

salut, merci!

cela m’était arrivé au début,

  • verifie bien la config des deux plugins octoprint mqtt et home assistant discovery. (à part l’ip du brocker mqtt, les login et mot de passe, j’ai quasiment tout laissé par défaut)
  • Par désespoir de cause j’avais tenté en installant les autres plugin mqtt d’octoprint publish et subscribe, et apres un ou deux redemarrage les infos remontaient (j’ai ensuite desinstaller subscribe et publish) je pense qu’il fallait simplement un ou deux reboot (reboot du rpi)…

Effectivement déjà dans mqqt (dans octoprint) je n’avais pas l’IP.

Ensuite dans discovery je mets quoi ? J’ai ça par défaut :

dans le plugin mqtt, n’oublie pas non l’identifiant et mdp :slight_smile: protocole version en 3.1
dans le plugin homeassistant discovery, rien a faire en principe

Bonsoir n écoutes, je pense avoir tout mis. …

bah ok, donc les infos remontent?
ton mdp à une majuscule?

/!\ de ne pas trop divilguer tes infos quand meme

Non toujours pas.
J’ai vérifié le user et mp d’octoprint c’est les bons…
l’IP aussi.

J’ai vérifié côté home assistant le broker est ok.
Côté Octoprint aussi…

Comment je pourrais vérifier ??

je pige pas

tu peux faire un imprim ecran de mqtt explorer voir ce qui remonte dedans?

@jybi89

Je viens d’installer le logiciel mqtt explorer.
J’ai mis protocole mqtt, validate certicat, port 1883. User mqtt, paswwd mqtt.

J’ai pas mis l’IP mais sebxxxxxx.duck.dns.org.
Et le soft se connecte. Avec l’IP ça marche pas…
J’ai donc mis la même chose dans octoprint. Message matt disconnected…
Je t’envoie un print screen