1
0
Fork 0

Log about previous change

main
Jordan Hotmann 2023-11-20 15:25:54 -07:00
parent 3d835cf5d5
commit 1fbce92da2
No known key found for this signature in database
GPG Key ID: 01B504170C2A2EA3
1 changed files with 1 additions and 0 deletions

View File

@ -135,6 +135,7 @@ func handleMessages() {
logger.Error("Error marshalling event data", "error", marshallErr) logger.Error("Error marshalling event data", "error", marshallErr)
} }
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")
nats.Publish(fmt.Sprintf("homeassistant.attributues.%s.%s", message.Event.Data.EntityId, message.Event.Data.NewState.State), data) nats.Publish(fmt.Sprintf("homeassistant.attributues.%s.%s", message.Event.Data.EntityId, message.Event.Data.NewState.State), data)
} else { } else {
nats.Publish(fmt.Sprintf("homeassistant.states.%s.%s", message.Event.Data.EntityId, message.Event.Data.NewState.State), data) nats.Publish(fmt.Sprintf("homeassistant.states.%s.%s", message.Event.Data.EntityId, message.Event.Data.NewState.State), data)