mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Downgrade OctoPrint printer disconnected errors (#63076)
Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
@@ -144,3 +144,46 @@ async def test_sensors_paused(hass):
|
||||
assert state.name == "OctoPrint Estimated Finish Time"
|
||||
entry = entity_registry.async_get("sensor.octoprint_estimated_finish_time")
|
||||
assert entry.unique_id == "Estimated Finish Time-uuid"
|
||||
|
||||
|
||||
async def test_sensors_printer_disconnected(hass):
|
||||
"""Test the underlying sensors."""
|
||||
job = {
|
||||
"job": {},
|
||||
"progress": {"completion": 50, "printTime": 600, "printTimeLeft": 6000},
|
||||
"state": "Paused",
|
||||
}
|
||||
with patch(
|
||||
"homeassistant.util.dt.utcnow", return_value=datetime(2020, 2, 20, 9, 10, 0)
|
||||
):
|
||||
await init_integration(hass, "sensor", printer=None, job=job)
|
||||
|
||||
entity_registry = er.async_get(hass)
|
||||
|
||||
state = hass.states.get("sensor.octoprint_job_percentage")
|
||||
assert state is not None
|
||||
assert state.state == "50"
|
||||
assert state.name == "OctoPrint Job Percentage"
|
||||
entry = entity_registry.async_get("sensor.octoprint_job_percentage")
|
||||
assert entry.unique_id == "Job Percentage-uuid"
|
||||
|
||||
state = hass.states.get("sensor.octoprint_current_state")
|
||||
assert state is not None
|
||||
assert state.state == "unavailable"
|
||||
assert state.name == "OctoPrint Current State"
|
||||
entry = entity_registry.async_get("sensor.octoprint_current_state")
|
||||
assert entry.unique_id == "Current State-uuid"
|
||||
|
||||
state = hass.states.get("sensor.octoprint_start_time")
|
||||
assert state is not None
|
||||
assert state.state == "unknown"
|
||||
assert state.name == "OctoPrint Start Time"
|
||||
entry = entity_registry.async_get("sensor.octoprint_start_time")
|
||||
assert entry.unique_id == "Start Time-uuid"
|
||||
|
||||
state = hass.states.get("sensor.octoprint_estimated_finish_time")
|
||||
assert state is not None
|
||||
assert state.state == "unknown"
|
||||
assert state.name == "OctoPrint Estimated Finish Time"
|
||||
entry = entity_registry.async_get("sensor.octoprint_estimated_finish_time")
|
||||
assert entry.unique_id == "Estimated Finish Time-uuid"
|
||||
|
||||
Reference in New Issue
Block a user