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

Patch for Print Time #108

Merged
merged 16 commits into from
Aug 6, 2023
Merged

Patch for Print Time #108

merged 16 commits into from
Aug 6, 2023

Conversation

mreditor97
Copy link
Contributor

This fixes problem #107, caused by the previous patch.

I have done some work to allow the Approximate Total Print Time, Print Time, and Print Time Left sensors to be displayed within graphs within the Home Assistant interface. I have changed Approximate Completion Time to use the built in Timestamp function within Home Assistant so it will now automatically display how long it left on your print once it has been started.

All of the time sensors now check to ensure that there is a valid value before changing from unavailable state. This means that if you do not have a print selected within Octoprint, the updated sensors will display unavailable.

Once a print has been selected within Octoprint, the Approximate Total Print Time will become available and will display the expected time for the print to complete.

Only once the print has started, will the Approximate Completion Time and Print Time Left become available with there actual values. Print Time is updated once the printer has actually started making progress through the print.

I hope this is a improvement for you all! Enjoy!

The suggestion for using graphs was in Feature Request #97
I also did a little bit of tiding up of any unused imports

@mreditor97 mreditor97 marked this pull request as ready for review July 5, 2023 21:40
@noy1122
Copy link

noy1122 commented Jul 8, 2023

how can I use it? what I need to do for working?
Thanks

@mreditor97
Copy link
Contributor Author

mreditor97 commented Jul 8, 2023

You can use test the patch here: https://github.com/mreditor97/octoprint-homeassistant/archive/patch/print-time.zip

Hopefully this helps. Let me know how you get on!

@noy1122
Copy link

noy1122 commented Jul 8, 2023

yeah, its working, thanks king!

@mill1000
Copy link

Commands to install via pip

pip uninstall octoprint-homeassistant
pip install git+https://github.com/mreditor97/octoprint-homeassistant.git@patch/print-time

@mreditor97 mreditor97 mentioned this pull request Jul 18, 2023
@bharvey88
Copy link

Commands to install via pip

pip uninstall octoprint-homeassistant
pip install git+https://github.com/mreditor97/octoprint-homeassistant.git@patch/print-time

Would you be willing to fork this and add #113 this breaking-change fix? Otherwise people on your fork will still have no joy come tomorrow at 2pm when the beta becomes the new stable.

@mreditor97
Copy link
Contributor Author

mreditor97 commented Aug 2, 2023

@bharvey88 Yes, of course.
I will add the fix for 2023.8 for when the beta comes available so we can have a working instance.

All my upcoming patches can be found here - https://github.com/mreditor97/octoprint-homeassistant/archive/master.zip

  • Fixing the print time issue
  • Added in device events (for print start and print complete notifications etc) for use in 2023.8
  • Changing to a slightly more accurate print percentage - we now have a decimal point!
  • Fixing the Home Assistant naming scheme to match the requirements of 2023.8

@halfluck
Copy link

halfluck commented Aug 3, 2023

I applied the above update but I still get the errors in HA "MQTT entity name starts with the device name in your config"
is there something else I need to change on my end?

Cheers

@mreditor97
Copy link
Contributor Author

@halfluck Did you update the plugin before updating Home Assistant? I found that the warning messages haven't come to light again since a restart of Home Assistant?

Let me know if this still occurs for you when you update to the latest version of my master branch of my fork?

@halfluck
Copy link

halfluck commented Aug 3, 2023

@mreditor97 Thanks for the quick reply, Yes I rebooted HA and OctoPrint after applying the update from your master branch,
This is my HA log after a fresh reboot

https://www.dropbox.com/scl/fi/y9zy6n1c4j8dejcex6iij/ha_log.txt?rlkey=xl57zi9yjppjsk2lal6qqs0br&dl=0

@mreditor97
Copy link
Contributor Author

@halfluck I'll look into why this happening when I get back from my holiday in a few days time.

@cmroche
Copy link
Owner

cmroche commented Aug 6, 2023

@mreditor97 @halfluck I do not think this is related to the change here. Looks like the MQTT integration at some point wanted the entity NOT to start with the device name, as far as I remember I think it always has with this plugin. It's a warning in any case..

@cmroche
Copy link
Owner

cmroche commented Aug 6, 2023

@mreditor97 Thanks for the contribution, looks good on my end.

@cmroche cmroche merged commit 8a0639b into cmroche:master Aug 6, 2023
@mreditor97 mreditor97 deleted the patch/print-time branch August 6, 2023 19:57
@mreditor97 mreditor97 restored the patch/print-time branch August 6, 2023 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants