fix entity not available when offline
Some checks failed
Validate with hassfest / validate (push) Failing after 2s
HACS Action / HACS Action (push) Failing after 4s

This commit is contained in:
Mathieu Broillet 2024-01-01 16:19:13 +01:00
parent 7ced302e12
commit ffb1d60575
Signed by: mathieu
GPG Key ID: C0E9E0E95AF03319

View File

@ -151,7 +151,8 @@ class ComputerSwitch(SwitchEntity):
name=self._attr_name,
manufacturer="Generic",
model="Computer",
sw_version=utils.get_operating_system_version(self._connection),
sw_version=utils.get_operating_system_version(
self._connection) if self._connection.is_connected() else "Unknown",
connections={(dr.CONNECTION_NETWORK_MAC, self._mac_address)},
)