Skip to content

Commit

Permalink
set retain to false for home assistant
Browse files Browse the repository at this point in the history
  • Loading branch information
gaetancollaud committed Dec 29, 2023
1 parent f6cd854 commit 8d88706
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 0 additions & 2 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ type ConfigHomeAssistant struct {
DiscoveryTopicPrefix string
RemoveRegexpFromName string
DigitalStromHost string
Retain bool
}
type Config struct {
Digitalstrom ConfigDigitalstrom
Expand Down Expand Up @@ -133,7 +132,6 @@ func ReadConfig() (*Config, error) {
DiscoveryTopicPrefix: viper.GetString(envKeyHomeAssistantDiscoveryPrefix),
RemoveRegexpFromName: viper.GetString(envKeyHomeAssistantRemoveRegexpFromName),
DigitalStromHost: viper.GetString(envKeyDigitalstromHost),
Retain: viper.GetBool(envKeyMqttRetain),
},
RefreshAtStart: viper.GetBool(envKeyRefreshAtStart),
LogLevel: viper.GetString(envKeyLogLevel),
Expand Down
6 changes: 3 additions & 3 deletions pkg/homeassistant/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ func (hass *HomeAssistantDiscovery) AddConfigs(configs []DiscoveryConfig) {
config.Config.
SetName(
utils.RemoveRegexp(
entityName,
hass.config.RemoveRegexpFromName)).
SetRetain(hass.config.Retain).
entityName,
hass.config.RemoveRegexpFromName)).
SetRetain(false). // do not retain, otherwise when we restart we would apply previous commands
AddAvailability(systemAvailability).
SetAvailabilityMode("all")
// Update the config with some generic attributes for all
Expand Down

0 comments on commit 8d88706

Please sign in to comment.