diff --git a/docs/api/devices.http b/docs/api/devices.http index 1a01fe3..c6e4299 100644 --- a/docs/api/devices.http +++ b/docs/api/devices.http @@ -1,5 +1,5 @@ // @no-cookie-jar -GET {{host}}/api/v1/apartment/dsDevices?includeAll=true +GET {{host}}/api/v1/apartment/dsDevices Authorization: Bearer {{api-key}} ### diff --git a/pkg/controller/modules/devices.go b/pkg/controller/modules/devices.go index dce0805..35df064 100644 --- a/pkg/controller/modules/devices.go +++ b/pkg/controller/modules/devices.go @@ -265,6 +265,7 @@ func (c *DeviceModule) GetHomeAssistantEntities() ([]homeassistant.DiscoveryConf c.deviceStateTopic(device.Attributes.Name, lightOutput.OutputId)) entityConfig.BrightnessCommandTopic = c.mqttClient.GetFullTopic( c.deviceCommandTopic(device.Attributes.Name, lightOutput.OutputId)) + entityConfig.StateValueTemplate = "{% if value|int > 0 %}100.00{% else %}0.00{% endif %}" } cfg = homeassistant.DiscoveryConfig{ Domain: homeassistant.Light, diff --git a/pkg/homeassistant/config.go b/pkg/homeassistant/config.go index c2934b1..ab950ee 100644 --- a/pkg/homeassistant/config.go +++ b/pkg/homeassistant/config.go @@ -86,6 +86,7 @@ type LightConfig struct { BaseConfig CommandTopic string `json:"command_topic,omitempty"` StateTopic string `json:"state_topic,omitempty"` + StateValueTemplate string `json:"state_value_template,omitempty"` PayloadOn string `json:"payload_on,omitempty"` PayloadOff string `json:"payload_off,omitempty"` OnCommandType string `json:"on_command_type,omitempty"`