Request for attributes
parent
e0fecbb317
commit
24c1a46360
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue