1
0
Fork 0

Don't use request for attribute changes

main
Jordan Hotmann 2023-12-07 12:45:38 -07:00
parent 653fb0e570
commit 630d85487c
No known key found for this signature in database
GPG Key ID: 01B504170C2A2EA3
1 changed files with 2 additions and 2 deletions

View File

@ -144,9 +144,9 @@ func handleMessages() {
go nats.SetKeyValueString(fmt.Sprintf("homeassistant.states.%s", message.Event.Data.EntityId), message.Event.Data.NewState.State)
if message.Event.Data.NewState.State == message.Event.Data.OldState.State {
logger.Debug("State unchanged, publishing to attributes topic")
nats.PublishRequest(fmt.Sprintf("homeassistant.attributues.%s.%s", message.Event.Data.EntityId, message.Event.Data.NewState.State), data, defaultTimeout, 2)
nats.Publish(fmt.Sprintf("homeassistant.attributues.%s.%s", message.Event.Data.EntityId, message.Event.Data.NewState.State), data)
} else {
nats.Publish(fmt.Sprintf("homeassistant.states.%s.%s", message.Event.Data.EntityId, message.Event.Data.NewState.State), data)
nats.PublishRequest(fmt.Sprintf("homeassistant.states.%s.%s", message.Event.Data.EntityId, message.Event.Data.NewState.State), data, defaultTimeout, 2)
}
case zhaEventId:
data, _ := json.Marshal(message.Event.Data)