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.
This commit is contained in:
parent
e7b9cecec9
commit
42750088b9
1 changed files with 5 additions and 1 deletions
|
@ -61,7 +61,7 @@ async def async_setup_entry(
|
||||||
for sensor_type in STORAGE_DISK_SENSORS
|
for sensor_type in STORAGE_DISK_SENSORS
|
||||||
]
|
]
|
||||||
|
|
||||||
async_add_entities(sensors, True)
|
async_add_entities(sensors)
|
||||||
|
|
||||||
|
|
||||||
class SynoNasSensor(Entity):
|
class SynoNasSensor(Entity):
|
||||||
|
@ -132,6 +132,10 @@ class SynoNasSensor(Entity):
|
||||||
"""No polling needed."""
|
"""No polling needed."""
|
||||||
return False
|
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):
|
async def async_added_to_hass(self):
|
||||||
"""Register state update callback."""
|
"""Register state update callback."""
|
||||||
self._unsub_dispatcher = async_dispatcher_connect(
|
self._unsub_dispatcher = async_dispatcher_connect(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue