Skip to content

Commit

Permalink
trim input messages
Browse files Browse the repository at this point in the history
  • Loading branch information
gaetancollaud committed Dec 13, 2023
1 parent e593a80 commit 7a45f5e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/controller/modules/devices.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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,
}
Expand Down Expand Up @@ -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,
}
Expand Down

0 comments on commit 7a45f5e

Please sign in to comment.