cmroche / OctoPrint-HomeAssistant

Home Assistant plugin for OctoPrint, enabling MQTT discovery of you device and sensors
110 stars 18 forks source link

Approximate Completion Time shows value when not printing #91

Closed tideline3d closed 2 years ago

tideline3d commented 2 years ago

Just upgraded to 3.6.0 as I was about to go through the effort to add template values in HA to calculate this exact thing. I threw it on the dashboard for some printers that aren't running and it's showing an approximate completion time for them.

I'd expect either a) it doesnt show a value if the printer isn't running a job or b) it shows the value of the last time a job was completed. It seems to be setting the default value to the time HA started. If I restart HA, all of these printers change to the new current time.

image

These are all idle printers, each time I restart HA this date resets to that point in time.

I see you're defaulting the value to 0, is that not translating to a valid timestamp so it picks something else?

cmroche commented 2 years ago

If there is no running print or estimation it will basically do “now() + 0”, restarting would put it in this state until a print is started. If a print is ongoing, it should update momentarily after restart once it received updated progress from the device.

tideline3d commented 2 years ago

Is there a way to null this value if a print isn't active? It seems confusing to me that I have a sensor telling me a completion time that is invalid. I have to look at another sensor to know if this one was actually valid at any given time.

cmroche commented 2 years ago

Not sure I could null it, I think it’s limited to “limited templating” which would make that hard. Might be able to mark the data as unavailable if no print is in progress though.

tideline3d commented 2 years ago

Works great, thanks!

image