fix: prevent print-job entities from showing as unavailable when idle#2014
Merged
AdrianGarside merged 1 commit intoMay 22, 2026
Merged
Conversation
|
To view this pull requests documentation preview, visit the following URL: docs.page/greghesp/ha-bambulab~2014 Documentation is deployed and generated using docs.page. |
AdrianGarside
requested changes
May 20, 2026
38042c0 to
8a83402
Compare
AdrianGarside
requested changes
May 20, 2026
- start_time, end_time, gcode_file and gcode_file_downloaded sensors now always available with null-safe value functions that return None when no data exists (showing 'unknown' instead of 'unavailable').
8a83402 to
5d6f68b
Compare
AdrianGarside
approved these changes
May 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes several entities becoming
unavailablein Home Assistant when the printer is idle or a print finishes. Entities now remain available at all times, with safety guards added to prevent commands being sent when the printer isn't in the correct state.Buttons (Pause / Resume / Stop) -
button.py:available()overrides so buttons inheritCoordinatorEntity.available(still correctly returnsFalsewhen MQTT/connectivity is lost)async_press()- commands are only published when the printer is in the correct gcode state; ignored presses log a warningPrinting Speed Select -
select.py:available()override that restricted the select togcode_state == 'RUNNING'async_select_option()checking forRUNNINGorPAUSEbefore applying speed changesPrint-job Sensors -
definitions.py:start_time: Setavailable_fnto always returnTrue; existing_start_time_value_fn()already safely returnsNoneend_time: Setavailable_fnto always returnTrue; add null guard tovalue_fnto preventdt_util.as_utc(None)raising anAttributeErrorgcode_file/gcode_file_downloaded: Setavailable_fnto always returnTrue; returnNoneinstead of empty string when no file is setType of Change
Documentation
Testing
Additional Notes
Claude was used to assist with these fixes and I have tested on my P1S with AMS. I verified the entities remain available when idle, show
unavailableonly when the printer is genuinely offline, and buttons/speed select still function correctly during a print.