Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Grizzelbee committed Jun 19, 2024
1 parent 6b8d558 commit a52d731
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion admin/jsonConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"type": "checkbox",
"label": "token_received",
"tooltip": "token_received_desc",
"defaultFunc": "data.token.length>0",
"defaultFunc": "data.token_received=(data.token.length > 0)",
"disabled": "true",
"sm": 30,
"md": 94,
Expand Down
2 changes: 1 addition & 1 deletion dyson-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ module.exports.zeroFill = function (number, width) {
* @returns {void}
* @throws
*/
module.exports.checkAdapterConfig = function (adapter) {
module.exports.checkAdapterConfig = async function (adapter) {
const config = adapter.config;

if (
Expand Down
5 changes: 4 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1496,12 +1496,14 @@ class dysonAirPurifier extends utils.Adapter {
// Terminate adapter after first start because configuration is not yet received
// Adapter is restarted automatically when config page is closed
try {
dysonUtils.checkAdapterConfig(this);
await dysonUtils.checkAdapterConfig(this);
await this.main();
} catch (error) {
this.log.warn(
`This adapter has no or no valid configuration. Starting anyway to give you the opportunity to configure it properly. ${error}`
);
// test if code is executed by mocha to exit properly and don't wait for getting configured
if (typeof global.it === 'function') this.terminate('Exiting due to mocha tests...', 11);
this.setState('info.connection', false, true);
}
}
Expand Down Expand Up @@ -1588,6 +1590,7 @@ class dysonAirPurifier extends utils.Adapter {
this.log.info(`Cleaned up timeout for ${thisDevice.Serial}.`);
// todo unsubscribe to any subscribes
}
this.setState('info.connection', false, true);
this.log.info('Cleaned up everything...');
callback();
} catch (e) {
Expand Down

0 comments on commit a52d731

Please sign in to comment.