updates to 0.115.5

This commit is contained in:
Mahasri Kalavala
2020-09-29 22:36:02 -04:00
parent 86d1f32caf
commit b21706d3cd
14 changed files with 402 additions and 775 deletions

View File

@@ -3,7 +3,7 @@ import logging
import requests
from homeassistant.const import TEMP_CELSIUS, UNIT_PERCENTAGE
from homeassistant.const import PERCENTAGE, TEMP_CELSIUS
from homeassistant.helpers.entity import Entity
from . import DOMAIN as COMPONENT_DOMAIN, SENSOR_TYPES
@@ -32,7 +32,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
"If you do not want to have your printer on <br />"
" at all times, and you would like to monitor <br /> "
"temperatures, please add <br />"
"bed and/or number&#95of&#95tools to your configuration <br />"
"bed and/or number&#95;of&#95;tools to your configuration <br />"
"and restart.",
title=NOTIFICATION_TITLE,
notification_id=NOTIFICATION_ID,
@@ -91,7 +91,7 @@ class OctoPrintSensor(Entity):
if tool is None:
self._name = f"{sensor_name} {condition}"
else:
self._name = "{} {} {} {}".format(sensor_name, condition, tool, "temp")
self._name = f"{sensor_name} {condition} {tool} temp"
self.sensor_type = sensor_type
self.api = api
self._state = None
@@ -111,7 +111,7 @@ class OctoPrintSensor(Entity):
def state(self):
"""Return the state of the sensor."""
sensor_unit = self.unit_of_measurement
if sensor_unit in (TEMP_CELSIUS, UNIT_PERCENTAGE):
if sensor_unit in (TEMP_CELSIUS, PERCENTAGE):
# API sometimes returns null and not 0
if self._state is None:
self._state = 0