Use DeviceInfo in syncthing (#58580)

Co-authored-by: epenet <epenet@users.noreply.github.com>
pull/58607/head
epenet 2021-10-28 14:30:02 +02:00 committed by GitHub
parent 383a820ae1
commit 03100693b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 8 deletions

View File

@ -6,6 +6,7 @@ from homeassistant.components.sensor import SensorEntity
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.exceptions import PlatformNotReady from homeassistant.exceptions import PlatformNotReady
from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.event import async_track_time_interval from homeassistant.helpers.event import async_track_time_interval
from .const import ( from .const import (
@ -130,15 +131,15 @@ class FolderSensor(SensorEntity):
return False return False
@property @property
def device_info(self): def device_info(self) -> DeviceInfo:
"""Return device information.""" """Return device information."""
return { return DeviceInfo(
"identifiers": {(DOMAIN, self._server_id)}, entry_type="service",
"name": f"Syncthing ({self._syncthing.url})", identifiers={(DOMAIN, self._server_id)},
"manufacturer": "Syncthing Team", manufacturer="Syncthing Team",
"sw_version": self._version, name=f"Syncthing ({self._syncthing.url})",
"entry_type": "service", sw_version=self._version,
} )
async def async_update_status(self): async def async_update_status(self):
"""Request folder status and update state.""" """Request folder status and update state."""