Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Homematic: Enhance Error Messages #6835

Merged
merged 7 commits into from
Mar 15, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
consider comments
  • Loading branch information
thierolm committed Mar 15, 2023
commit da3ae27d8bde019a5b17909a7bcf16e065fa3091
12 changes: 6 additions & 6 deletions meter/homematic/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,17 +153,17 @@ func ParseHmError(res MethodResponse) error {
var faultString string

faultCode = 0
for i := 0; i < len(res.Fault); i++ {
if res.Fault[i].Name == "faultCode" {
faultCode = res.Fault[i].Value.CCUInt
for _, f := range res.Fault {
if f.Name == "faultCode" {
faultCode = f.Value.CCUInt
}
if res.Fault[i].Name == "faultString" {
faultString = res.Fault[i].Value.CCUString
if f.Name == "faultString" {
faultString = f.Value.CCUString
}
}

if faultCode != 0 {
return fmt.Errorf("CCU error: %s (faultcode %v)", faultString, faultCode)
return fmt.Errorf("%s (%v)", faultString, faultCode)
}

return nil
Expand Down