From 7a45f5e65a601d278c80aa160c8e64983425e35e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=A9tan=20Collaud?= Date: Wed, 13 Dec 2023 22:26:20 +0100 Subject: [PATCH] trim input messages --- pkg/controller/modules/devices.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/controller/modules/devices.go b/pkg/controller/modules/devices.go index 2e88d81..3ddfa68 100644 --- a/pkg/controller/modules/devices.go +++ b/pkg/controller/modules/devices.go @@ -113,7 +113,7 @@ func (c *DeviceModule) onMqttMessage(deviceId string, outputId string, message s return err } - value, err := strconv.ParseFloat(message, 64) + value, err := strconv.ParseFloat(strings.TrimSpace(message), 64) if err != nil { return fmt.Errorf("error parsing message as float value: %w", err) } @@ -263,7 +263,7 @@ func (c *DeviceModule) GetHomeAssistantEntities() ([]homeassistant.DiscoveryConf } cfg = homeassistant.DiscoveryConfig{ Domain: homeassistant.Light, - DeviceId: device.Attributes.Dsid, // retro compatibility + DeviceId: device.DeviceId, ObjectId: "light", Config: entityConfig, } @@ -303,7 +303,7 @@ func (c *DeviceModule) GetHomeAssistantEntities() ([]homeassistant.DiscoveryConf } cfg = homeassistant.DiscoveryConfig{ Domain: homeassistant.Cover, - DeviceId: device.Attributes.Dsid, // retro compatibility + DeviceId: device.DeviceId, ObjectId: "cover", Config: entityConfig, }