1
0
Fork 0

Request for attributes

main
Jordan Hotmann 2024-05-21 16:30:36 -06:00
parent e0fecbb317
commit 24c1a46360
No known key found for this signature in database
GPG Key ID: 01B504170C2A2EA3
1 changed files with 1 additions and 1 deletions

View File

@ -147,7 +147,7 @@ func handleMessages() {
cleanedState := stateReplacer.Replace(message.Event.Data.NewState.State) cleanedState := stateReplacer.Replace(message.Event.Data.NewState.State)
if message.Event.Data.NewState.State == message.Event.Data.OldState.State { if message.Event.Data.NewState.State == message.Event.Data.OldState.State {
logger.Debug("State unchanged, publishing to attributes topic") logger.Debug("State unchanged, publishing to attributes topic")
nats.Publish(fmt.Sprintf("homeassistant.attributes.%s.%s", message.Event.Data.EntityId, cleanedState), data) nats.PublishRequest(fmt.Sprintf("homeassistant.attributes.%s.%s", message.Event.Data.EntityId, cleanedState), data, defaultTimeout, 1)
} else { } else {
nats.PublishRequest(fmt.Sprintf("homeassistant.states.%s.%s", message.Event.Data.EntityId, cleanedState), data, defaultTimeout, 2) nats.PublishRequest(fmt.Sprintf("homeassistant.states.%s.%s", message.Event.Data.EntityId, cleanedState), data, defaultTimeout, 2)
} }