Use DeviceInfo in sms (#58525)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2021-10-27 13:16:59 +02:00 committed by GitHub
parent 6f14f954f9
commit 8e62fc254a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,6 +5,7 @@ import gammu # pylint: disable=import-error
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription
from homeassistant.const import DEVICE_CLASS_SIGNAL_STRENGTH, SIGNAL_STRENGTH_DECIBELS
from homeassistant.helpers.entity import DeviceInfo
from .const import DOMAIN, SMS_GATEWAY
@ -39,10 +40,10 @@ class GSMSignalSensor(SensorEntity):
def __init__(self, hass, gateway, imei, description):
"""Initialize the GSM Signal sensor."""
self._attr_device_info = {
"identifiers": {(DOMAIN, str(imei))},
"name": "SMS Gateway",
}
self._attr_device_info = DeviceInfo(
identifiers={(DOMAIN, str(imei))},
name="SMS Gateway",
)
self._attr_unique_id = str(imei)
self._hass = hass
self._gateway = gateway