Add current and latest firmware info to Synology_dsm (#56460)

pull/56711/head
Simone Chemelli 2021-09-27 12:23:26 +02:00 committed by GitHub
parent 58f465f271
commit b612e16120
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -1,6 +1,7 @@
"""Support for Synology DSM binary sensors."""
from __future__ import annotations
from collections.abc import Mapping
from typing import Any
from homeassistant.components.binary_sensor import BinarySensorEntity
@ -129,3 +130,11 @@ class SynoDSMUpgradeBinarySensor(SynoDSMBinarySensor):
def available(self) -> bool:
"""Return True if entity is available."""
return bool(self._api.upgrade)
@property
def extra_state_attributes(self) -> Mapping[str, Any] | None:
"""Return firmware details."""
return {
"installed_version": self._api.information.version_string,
"latest_available_version": self._api.upgrade.available_version,
}