From 42750088b93c2e5eb09e4078c5b1a1a6283fbd90 Mon Sep 17 00:00:00 2001 From: Ron Heft Date: Sun, 3 May 2020 19:07:14 -0400 Subject: [PATCH] Add support for refreshing synology_dsm sensors (#35141) * Add support for refreshing synology_dsm sensors Now supports `home_assistant.update_entity` service * Don't immediately update sensors on add This fixes all sensors being forcefully refreshed when setup. --- homeassistant/components/synology_dsm/sensor.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/synology_dsm/sensor.py b/homeassistant/components/synology_dsm/sensor.py index b6a88fe5a5a..e2631b9c4ed 100644 --- a/homeassistant/components/synology_dsm/sensor.py +++ b/homeassistant/components/synology_dsm/sensor.py @@ -61,7 +61,7 @@ async def async_setup_entry( for sensor_type in STORAGE_DISK_SENSORS ] - async_add_entities(sensors, True) + async_add_entities(sensors) class SynoNasSensor(Entity): @@ -132,6 +132,10 @@ class SynoNasSensor(Entity): """No polling needed.""" return False + async def async_update(self): + """Only used by the generic entity update service.""" + await self._api.update() + async def async_added_to_hass(self): """Register state update callback.""" self._unsub_dispatcher = async_dispatcher_connect(