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

Improve conversion function stability #494

Open
holomekc opened this issue Sep 29, 2024 · 0 comments
Open

Improve conversion function stability #494

holomekc opened this issue Sep 29, 2024 · 0 comments

Comments

@holomekc
Copy link

Hi,
First of all thx for the awesome work!

I would like to suggest a minor enhancement, so the issue I will mention was totally my mistake and is not an issue of the adapter.

After updating I received issues like this:
image

Without the information which device and service is affected it is kind of difficult to figure out what created the issue. Therefore, I checked the code and added a try/catch block. The code section I adjusted was:

ioBroker.yahka/main.js

Lines 1588 to 1597 in f380bb7

toHomeKit(value) {
let newValue = this.toHKFunction(value);
this.adapter.log.debug(`script: converting value to homekit: ${value} to ${newValue}`);
return newValue;
}
toIOBroker(value) {
let newValue = this.toIOFunction(value);
this.adapter.log.debug(`script: converting value to ioBroker: ${value} to ${newValue}`);
return newValue;
}

I did the following:

toHomeKit(value) {
        try {
          let newValue = this.toHKFunction(value);
          this.adapter.log.debug(`script: converting value to homekit: ${value} to ${newValue}`);
          return newValue;
        } catch(error) {
           this.adapter.log.error(`Could not convert values to HomeKit for : ${JSON.stringify(this.parameters)}`);
           throw error;
        }
    }

It would be great if there were more information except the function themselves. But I am not sure if this is possible. At least it helped me to figure out which services are creating the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant