Migrate integrations r-s to extend SensorEntity (#48215)

This commit is contained in:
Erik Montnemery 2021-03-22 19:54:14 +01:00 committed by GitHub
parent 0c086b5067
commit 64bc9a8196
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
75 changed files with 173 additions and 189 deletions

View file

@ -3,7 +3,7 @@ from random import randrange
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import (
CONF_MAXIMUM,
CONF_MINIMUM,
@ -11,7 +11,6 @@ from homeassistant.const import (
CONF_UNIT_OF_MEASUREMENT,
)
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
ATTR_MAXIMUM = "maximum"
ATTR_MINIMUM = "minimum"
@ -42,7 +41,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities([RandomSensor(name, minimum, maximum, unit)], True)
class RandomSensor(Entity):
class RandomSensor(SensorEntity):
"""Representation of a Random number sensor."""
def __init__(self, name, minimum, maximum, unit_of_measurement):