Fix mysensors sensor protocol version check (#49257)
This commit is contained in:
parent
4f5c745492
commit
1b5148a3af
1 changed files with 3 additions and 1 deletions
|
@ -1,6 +1,8 @@
|
|||
"""Support for MySensors sensors."""
|
||||
from typing import Callable
|
||||
|
||||
from awesomeversion import AwesomeVersion
|
||||
|
||||
from homeassistant.components import mysensors
|
||||
from homeassistant.components.mysensors import on_unload
|
||||
from homeassistant.components.mysensors.const import MYSENSORS_DISCOVERY
|
||||
|
@ -115,7 +117,7 @@ class MySensorsSensor(mysensors.device.MySensorsEntity, SensorEntity):
|
|||
"""Return the unit of measurement of this entity."""
|
||||
set_req = self.gateway.const.SetReq
|
||||
if (
|
||||
float(self.gateway.protocol_version) >= 1.5
|
||||
AwesomeVersion(self.gateway.protocol_version) >= AwesomeVersion("1.5")
|
||||
and set_req.V_UNIT_PREFIX in self._values
|
||||
):
|
||||
return self._values[set_req.V_UNIT_PREFIX]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue