mirror of
https://github.com/skalavala/mysmarthome.git
synced 2025-08-21 04:33:22 +00:00
updates to 0.115.5
This commit is contained in:
@@ -18,9 +18,9 @@ from homeassistant.const import (
|
||||
CONF_SENSORS,
|
||||
CONF_SSL,
|
||||
CONTENT_TYPE_JSON,
|
||||
PERCENTAGE,
|
||||
TEMP_CELSIUS,
|
||||
TIME_SECONDS,
|
||||
UNIT_PERCENTAGE,
|
||||
)
|
||||
from homeassistant.helpers import discovery
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
@@ -76,7 +76,7 @@ SENSOR_TYPES = {
|
||||
"job",
|
||||
"progress",
|
||||
"completion",
|
||||
UNIT_PERCENTAGE,
|
||||
PERCENTAGE,
|
||||
"mdi:file-percent",
|
||||
],
|
||||
"Time Remaining": [
|
||||
@@ -146,9 +146,10 @@ def setup(hass, config):
|
||||
|
||||
for printer in config[DOMAIN]:
|
||||
name = printer[CONF_NAME]
|
||||
ssl = "s" if printer[CONF_SSL] else ""
|
||||
base_url = "http{}://{}:{}{}api/".format(
|
||||
ssl, printer[CONF_HOST], printer[CONF_PORT], printer[CONF_PATH]
|
||||
protocol = "https" if printer[CONF_SSL] else "http"
|
||||
base_url = (
|
||||
f"{protocol}://{printer[CONF_HOST]}:{printer[CONF_PORT]}"
|
||||
f"{printer[CONF_PATH]}api/"
|
||||
)
|
||||
api_key = printer[CONF_API_KEY]
|
||||
number_of_tools = printer[CONF_NUMBER_OF_TOOLS]
|
||||
@@ -230,7 +231,6 @@ class OctoPrintAPI:
|
||||
return self.printer_last_reading[0]
|
||||
|
||||
url = self.api_url + endpoint
|
||||
|
||||
try:
|
||||
response = requests.get(url, headers=self.headers, timeout=9)
|
||||
response.raise_for_status()
|
||||
|
Reference in New Issue
Block a user