1
0
Fork 0

More logging

main
Jordan Hotmann 2023-11-20 14:55:25 -07:00
parent 57e107b226
commit df393879ac
No known key found for this signature in database
GPG Key ID: 01B504170C2A2EA3
1 changed files with 7 additions and 0 deletions

View File

@ -158,17 +158,24 @@ func setEntityStateHandler(w http.ResponseWriter, r *http.Request) {
var extras map[string]any var extras map[string]any
err := render.DecodeJSON(r.Body, &extras) err := render.DecodeJSON(r.Body, &extras)
if err != nil {
logger.Error("Error decoding JSON body", "error", err)
}
var haErr error var haErr error
if err == nil && len(extras) > 0 { if err == nil && len(extras) > 0 {
if domain != "" { if domain != "" {
logger.Debug("Calling service manually", "service", service, "domain", domain, "entity", entityId, "extras", extras)
haErr = haClient.CallServiceManual(domain, entityId, service, extras) haErr = haClient.CallServiceManual(domain, entityId, service, extras)
} else { } else {
logger.Debug("Calling service", "service", service, "entity", entityId, "extras", extras)
haErr = haClient.CallService(entityId, service, extras) haErr = haClient.CallService(entityId, service, extras)
} }
} else { } else {
if domain != "" { if domain != "" {
logger.Debug("Calling service manually (without extras)", "service", service, "domain", domain, "entity", entityId)
haErr = haClient.CallServiceManual(domain, entityId, service) haErr = haClient.CallServiceManual(domain, entityId, service)
} else { } else {
logger.Debug("Calling service (without extras)", "service", service, "entity", entityId)
haErr = haClient.CallService(entityId, service) haErr = haClient.CallService(entityId, service)
} }
} }