Add and use UNIT_DEGREE constant (#33978)

* Add and use UNIT_DEGREE constant

* Replace more occurrences

* Add and use TEMP_KELVIN

* Run isort
This commit is contained in:
springstan 2020-04-11 16:54:11 +02:00 committed by GitHub
parent c18a6d5ea3
commit b893150154
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 67 additions and 47 deletions

View file

@ -6,7 +6,7 @@ import voluptuous as vol
from homeassistant.components.http import HomeAssistantView
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_EMAIL, CONF_NAME
from homeassistant.const import CONF_EMAIL, CONF_NAME, UNIT_DEGREE
from homeassistant.core import callback
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
@ -91,7 +91,7 @@ class TorqueReceiveDataView(HomeAssistantView):
temp_unit = data[key]
if "\\xC2\\xB0" in temp_unit:
temp_unit = temp_unit.replace("\\xC2\\xB0", "°")
temp_unit = temp_unit.replace("\\xC2\\xB0", UNIT_DEGREE)
units[pid] = temp_unit
elif is_value: