Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request] Sensor: Material used #77

Open
Darklyte opened this issue Oct 11, 2021 · 2 comments
Open

[Request] Sensor: Material used #77

Darklyte opened this issue Oct 11, 2021 · 2 comments
Labels

Comments

@Darklyte
Copy link

I would really love if octoprint could send HA the amount of material used (grams, cm, etc) as sensors to home assistant. I'd love to be able to send myself a notification with the total cost of a print once it finishes, and be able to more easily keep track of filament usage.

@cmroche
Copy link
Owner

cmroche commented Nov 5, 2021

Thanks for the suggestion.

To be honest, I'm not sure if I will really be able to get that information, but I'll take a look through the update messages to see what information is provided.

@Wummeke
Copy link

Wummeke commented Aug 18, 2023

This used to be sent, but recently disappeared somehow. I had these template sensors in Home-Assistant to show them on my dashboard:

      filament_menge:
        friendly_name: "Filament Menge"
        unit_of_measurement: "m"
        value_template: >
          {% if states.sensor.octoprint_print_estimated_time.state != 'None' %}
            {{ (state_attr('sensor.octoprint_print_estimated_time', 'filament'))['tool0']['length'] | round(1) | default(0) }}
          {%else%}
            {{"0"}}
          {% endif %}

      filament_volumen:
        friendly_name: "Filament Volumen"
        unit_of_measurement: "g"
        value_template: >
          {% if states.sensor.octoprint_print_estimated_time.state != 'None' %}
            {{ (state_attr('sensor.octoprint_print_estimated_time', 'filament'))['tool0']['volume'] | round(1) | default(0) }}
          {%else%}
            {{"0"}}
          {% endif %}

      gcode_grosse:
        friendly_name: "Gcode Größe"
        unit_of_measurement: "MB"
        value_template: >
          {% if states.sensor.octoprint_print_estimated_time.state != 'None' %}
            {{ ((state_attr('sensor.octoprint_print_estimated_time', 'file'))['size'] | float /1000000) | round(3) | default(0) }}
          {%else%}
            {{"0"}}
          {% endif %}

My guess is that the used values came from this topic: octoprint/progress/printing
The file and filament 'nodes' are still there in the JSON. However, the filament node is now empty and contents from both nodes aren't exposed in HA anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants