mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Suppress logs when octorpint goes offline (#7441)
* Suppress logs when octorpint goes offline * Fixed line length
This commit is contained in:
parent
cc0299d046
commit
8d50045971
@ -85,18 +85,16 @@ class OctoPrintAPI(object):
|
|||||||
self.printer_last_reading[0] = response.json()
|
self.printer_last_reading[0] = response.json()
|
||||||
self.printer_last_reading[1] = time.time()
|
self.printer_last_reading[1] = time.time()
|
||||||
return response.json()
|
return response.json()
|
||||||
except requests.exceptions.ConnectionError as conn_exc:
|
except (requests.exceptions.ConnectionError,
|
||||||
|
requests.exceptions.HTTPError) as conn_exc:
|
||||||
_LOGGER.error("Failed to update OctoPrint status. Error: %s",
|
_LOGGER.error("Failed to update OctoPrint status. Error: %s",
|
||||||
conn_exc)
|
conn_exc)
|
||||||
raise
|
|
||||||
|
|
||||||
def update(self, sensor_type, end_point, group, tool=None):
|
def update(self, sensor_type, end_point, group, tool=None):
|
||||||
"""Return the value for sensor_type from the provided endpoint."""
|
"""Return the value for sensor_type from the provided endpoint."""
|
||||||
try:
|
response = self.get(end_point)
|
||||||
return get_value_from_json(
|
if response is not None:
|
||||||
self.get(end_point), sensor_type, group, tool)
|
return get_value_from_json(response, sensor_type, group, tool)
|
||||||
except requests.exceptions.ConnectionError:
|
|
||||||
raise
|
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=unused-variable
|
# pylint: disable=unused-variable
|
||||||
|
Loading…
x
Reference in New Issue
Block a user