Skip to content

Commit

Permalink
Merge pull request #303 from Grizzelbee/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
Grizzelbee authored Jun 20, 2024
2 parents df53614 + ae130e2 commit 8e57861
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 19 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
9 changes: 5 additions & 4 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1338,11 +1338,11 @@ class dysonAirPurifier extends utils.Adapter {
}
});
// Sets the interval for status updates
adapterLog.info(
`Starting Polltimer with a ${adapter.config.pollInterval} seconds interval for device ${thisDevice.Serial}.`
);
// start refresh scheduler with interval from adapters config
if (adapter.config.pollInterval > 0) {
adapterLog.info(
`Starting Polltimer with a ${adapter.config.pollInterval} seconds interval for device ${thisDevice.Serial}.`
);
thisDevice.updateIntervalHandle = setInterval(()=> {
adapter.pollDeviceInfo(thisDevice, adapterLog, '@ regular schedule');
}, adapter.config.pollInterval * 1000);
Expand Down Expand Up @@ -1496,7 +1496,7 @@ 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(
Expand Down Expand Up @@ -1588,6 +1588,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
24 changes: 12 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"flatted": "^3.3.1",
"https": "^1.0.0",
"lodash": "^4.17.21",
"mqtt": "^5.7.0",
"mqtt": "^5.7.1",
"path": "^0.12.7"
},
"devDependencies": {
Expand Down

0 comments on commit 8e57861

Please sign in to comment.