From c92750f6e7444ebdad5d7a84d477db48cbd450cc Mon Sep 17 00:00:00 2001 From: "Sergey V. DUDANOV" Date: Thu, 18 Jul 2024 23:49:25 +0400 Subject: [PATCH] added targets speed and inclination --- custom_components/ftms/number.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/custom_components/ftms/number.py b/custom_components/ftms/number.py index a5159fc..5aac6a1 100644 --- a/custom_components/ftms/number.py +++ b/custom_components/ftms/number.py @@ -8,7 +8,7 @@ NumberEntity, NumberEntityDescription, ) -from homeassistant.const import UnitOfPower +from homeassistant.const import UnitOfPower, UnitOfSpeed from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity_platform import AddEntitiesCallback from pyftms.client import const as c @@ -18,6 +18,18 @@ _LOGGER = logging.getLogger(__name__) +_SPEED = NumberEntityDescription( + key=c.TARGET_SPEED, + device_class=NumberDeviceClass.SPEED, + native_unit_of_measurement=UnitOfSpeed.KILOMETERS_PER_HOUR, +) + +_INCLINATION = NumberEntityDescription( + key=c.TARGET_INCLINATION, + native_unit_of_measurement="%", +) + + _RESISTANCE_LEVEL = NumberEntityDescription( key=c.TARGET_RESISTANCE, ) @@ -32,6 +44,8 @@ _ENTITIES = ( _RESISTANCE_LEVEL, _POWER, + _SPEED, + _INCLINATION, )