mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Fix mysensors sensor protocol version check (#49257)
This commit is contained in:
parent
4f5c745492
commit
1b5148a3af
@ -1,6 +1,8 @@
|
|||||||
"""Support for MySensors sensors."""
|
"""Support for MySensors sensors."""
|
||||||
from typing import Callable
|
from typing import Callable
|
||||||
|
|
||||||
|
from awesomeversion import AwesomeVersion
|
||||||
|
|
||||||
from homeassistant.components import mysensors
|
from homeassistant.components import mysensors
|
||||||
from homeassistant.components.mysensors import on_unload
|
from homeassistant.components.mysensors import on_unload
|
||||||
from homeassistant.components.mysensors.const import MYSENSORS_DISCOVERY
|
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."""
|
"""Return the unit of measurement of this entity."""
|
||||||
set_req = self.gateway.const.SetReq
|
set_req = self.gateway.const.SetReq
|
||||||
if (
|
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
|
and set_req.V_UNIT_PREFIX in self._values
|
||||||
):
|
):
|
||||||
return self._values[set_req.V_UNIT_PREFIX]
|
return self._values[set_req.V_UNIT_PREFIX]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user