Closed sushibagel closed 1 year ago
Sorry, I am just in the middle of a patch for this.
Sorry, I am just in the middle of a patch for this.
No need to apologize, I appreciate your work and just didn't see an report of it yet.
I added it, however I found a additional warning within Home Assistant, so just improving those before resubmitting the pull. I'll tag it here once it is done. Thanks :)
The fix is ready and waiting now. It is fully working as expected on my end.
It would be great if you could confirm it works as expected on your end too by installing it, you can do it from my fork: https://github.com/mreditor97/octoprint-homeassistant/archive/patch/print-time.zip
The fix is ready and waiting now. It is fully working as expected on my end. It would be great if you could confirm it works as expected on your end too by installing it, you can do it from my fork:
https://github.com/mreditor97/octoprint-homeassistant/archive/patch/print-time.zip
Seems to be working. Print time is still showing "Unavailable" but it may be due to the fact that I had just started the print. I'll update if it doesn't populate.
Edit: Print time did eventually populate as well. Thank you!
The fix is ready and waiting now. It is fully working as expected on my end. It would be great if you could confirm it works as expected on your end too by installing it, you can do it from my fork:
https://github.com/mreditor97/octoprint-homeassistant/archive/patch/print-time.zip
I just realized that print times with notifications now seem to be showing wrong (in seconds maybe?).
Here is the relevant code from the notification.
Unfortunately the time is provided in seconds now, as that is required for Home Assistant so that it can be put into a graph.
You should be able to sort this by adding timedelta
into the template of your notification:
It should look something like this: {{ timedelta(seconds=states('sensor.octoprint_print_time_left')|int(default=0)) }}
This will do the conversion from seconds to a readable time for you. The same will be required of the sensor.octoprint_print_time
as well.
Unfortunately the time is provided in seconds now, as that is required for Home Assistant so that it can be put into a graph.
You should be able to sort this by adding
timedelta
into the template of your notification: It should look something like this:{{ timedelta(seconds=states('sensor.octoprint_print_time_left')|int(default=0)) }}
This will do the conversion from seconds to a readable time for you. The same will be required of the
sensor.octoprint_print_time
as well.
Makes sense. Thanks for the quick reply.
As a potential remedy to this, I could make it send the old timing method through as a attribute of the Print Time Left sensor? Would that be a good possible solution?
As a potential remedy to this, I could make it send the old timing method through as a attribute of the Print Time Left sensor? Would that be a good possible solution?
I don't know that it's really necessary. Your solution worked. You may just want to add it to the documentation.
I believe you should be able to prettify it too, but I'll look into that.
I will add some documentation when I get chance. Glad it works for you!
HomeAssistant Discovery (3.6.5) clean install Home Assistant 2023.7.1
All time measurements stiil not working log HA https://pastebin.com/0Q57zrYA
@rozhkovets The patch I have made is waiting to be pushed into the live version - this fixes the error you are getting.
https://github.com/mreditor97/octoprint-homeassistant/archive/patch/print-time.zip
Can you try to install it manually, at the link provided above and let me know if that works for you?
@mreditor97, its works, thanks
but, I noticed a strange thing, print time was unavailable and was updated after ending G29, at the same time other time measurements were updated immediately after i start of printing
Yes, I have the same thing on my end.
I believe this is due to Octoprint not pushing the current print time until after the initial movement commands have been sent (I believe).
I will look into it to see whether there is a potential remedy to this.
I've tried restarting Home Assistant but for some reason after the latest update none of the Time Measurements seem to update in Home Assistant.