Downgrade OctoPrint printer disconnected errors (#63076)
Co-authored-by: Franck Nijhof <git@frenck.dev>pull/63286/head
parent
cba752c1af
commit
d85d93d1a1
|
@ -225,7 +225,7 @@ class OctoprintDataUpdateCoordinator(DataUpdateCoordinator):
|
|||
printer = await self._octoprint.get_printer_info()
|
||||
except PrinterOffline:
|
||||
if not self._printer_offline:
|
||||
_LOGGER.error("Unable to retrieve printer information: Printer offline")
|
||||
_LOGGER.debug("Unable to retrieve printer information: Printer offline")
|
||||
self._printer_offline = True
|
||||
except ApiError as err:
|
||||
raise UpdateFailed(err) from err
|
||||
|
|
|
@ -62,7 +62,7 @@ async def async_setup_entry(
|
|||
)
|
||||
)
|
||||
else:
|
||||
_LOGGER.error("Printer appears to be offline, skipping temperature sensors")
|
||||
_LOGGER.debug("Printer appears to be offline, skipping temperature sensors")
|
||||
|
||||
entities.append(OctoPrintStatusSensor(coordinator, device_id))
|
||||
entities.append(OctoPrintJobPercentageSensor(coordinator, device_id))
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue