Skip to content

Commit

Permalink
Removed device temperature checks when not used
Browse files Browse the repository at this point in the history
  • Loading branch information
kiwi-cam committed Jan 9, 2025
1 parent b3154fc commit 1d6cbf4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Changed
- Stopped device temperature checks when they're not applicable (MQTT, File, W1)

## [4.4.19 - 2024-09-30]
### Fixed
Expand Down
25 changes: 14 additions & 11 deletions accessories/aircon.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,28 +399,31 @@ class AirConAccessory extends BroadlinkRMAccessory {

async monitorTemperature () {
const { config, host, log, logLevel, name, state } = this;
const { temperatureFilePath, pseudoDeviceTemperature, w1DeviceID } = config;
const { temperatureFilePath, pseudoDeviceTemperature, w1DeviceID, mqttURL } = config;

if (pseudoDeviceTemperature !== undefined) {return;}

//Force w1 and file devices to a minimum 1 minute refresh
if (w1DeviceID || temperatureFilePath) {config.temperatureUpdateFrequency = Math.max(config.temperatureUpdateFrequency,60);}

const device = getDevice({ host, log });
if (logLevel <=1) {log(`${name} monitorTemperature`);}

// Try again in a second if we don't have a device yet
if (!device) {
await delayForDuration(1);
if (!w1DeviceID && !temperatureFilePath && !mqttURL){
//Update Device if applicable
const device = getDevice({ host, log });

Check failure on line 413 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 413 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and macOS-latest

Expected indentation of 6 spaces but found 8

Check failure on line 413 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and macOS-latest

Expected indentation of 6 spaces but found 8

Check failure on line 413 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 413 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 413 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and macOS-latest

Expected indentation of 6 spaces but found 8

Check failure on line 413 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and macOS-latest

Expected indentation of 6 spaces but found 8

Check failure on line 413 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 413 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and macOS-latest

Expected indentation of 6 spaces but found 8

Check failure on line 413 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 413 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 413 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and macOS-latest

Expected indentation of 6 spaces but found 8

this.monitorTemperature();
// Try again in a second if we don't have a device yet

Check failure on line 415 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 415 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and macOS-latest

Expected indentation of 6 spaces but found 8

Check failure on line 415 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and macOS-latest

Expected indentation of 6 spaces but found 8

Check failure on line 415 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 415 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 415 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and macOS-latest

Expected indentation of 6 spaces but found 8

Check failure on line 415 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and macOS-latest

Expected indentation of 6 spaces but found 8

Check failure on line 415 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 415 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and macOS-latest

Expected indentation of 6 spaces but found 8

Check failure on line 415 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 415 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 415 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and macOS-latest

Expected indentation of 6 spaces but found 8
if (!device) {

Check failure on line 416 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 416 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and macOS-latest

Expected indentation of 6 spaces but found 8

Check failure on line 416 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and macOS-latest

Expected indentation of 6 spaces but found 8

Check failure on line 416 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 416 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 416 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and macOS-latest

Expected indentation of 6 spaces but found 8

Check failure on line 416 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and macOS-latest

Expected indentation of 6 spaces but found 8

Check failure on line 416 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 416 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and macOS-latest

Expected indentation of 6 spaces but found 8

Check failure on line 416 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 416 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 416 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and macOS-latest

Expected indentation of 6 spaces but found 8
await delayForDuration(1);

Check failure on line 417 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and ubuntu-latest

Expected indentation of 8 spaces but found 12

Check failure on line 417 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and macOS-latest

Expected indentation of 8 spaces but found 12

Check failure on line 417 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and macOS-latest

Expected indentation of 8 spaces but found 12

Check failure on line 417 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and ubuntu-latest

Expected indentation of 8 spaces but found 12

Check failure on line 417 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and ubuntu-latest

Expected indentation of 8 spaces but found 12

Check failure on line 417 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and macOS-latest

Expected indentation of 8 spaces but found 12

Check failure on line 417 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and macOS-latest

Expected indentation of 8 spaces but found 12

Check failure on line 417 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and ubuntu-latest

Expected indentation of 8 spaces but found 12

Check failure on line 417 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and macOS-latest

Expected indentation of 8 spaces but found 12

Check failure on line 417 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and ubuntu-latest

Expected indentation of 8 spaces but found 12

Check failure on line 417 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and ubuntu-latest

Expected indentation of 8 spaces but found 12

Check failure on line 417 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and macOS-latest

Expected indentation of 8 spaces but found 12

return;
}
this.monitorTemperature();

Check failure on line 419 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and ubuntu-latest

Expected indentation of 8 spaces but found 12

Check failure on line 419 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and macOS-latest

Expected indentation of 8 spaces but found 12

Check failure on line 419 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and macOS-latest

Expected indentation of 8 spaces but found 12

Check failure on line 419 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and ubuntu-latest

Expected indentation of 8 spaces but found 12

Check failure on line 419 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and ubuntu-latest

Expected indentation of 8 spaces but found 12

Check failure on line 419 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and macOS-latest

Expected indentation of 8 spaces but found 12

Check failure on line 419 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and macOS-latest

Expected indentation of 8 spaces but found 12

Check failure on line 419 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and ubuntu-latest

Expected indentation of 8 spaces but found 12

Check failure on line 419 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and macOS-latest

Expected indentation of 8 spaces but found 12

Check failure on line 419 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and ubuntu-latest

Expected indentation of 8 spaces but found 12

Check failure on line 419 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and ubuntu-latest

Expected indentation of 8 spaces but found 12

Check failure on line 419 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and macOS-latest

Expected indentation of 8 spaces but found 12

if (logLevel <=1) {log(`${name} monitorTemperature`);}
return;

Check failure on line 421 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and ubuntu-latest

Expected indentation of 8 spaces but found 12

Check failure on line 421 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and macOS-latest

Expected indentation of 8 spaces but found 12

Check failure on line 421 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and macOS-latest

Expected indentation of 8 spaces but found 12

Check failure on line 421 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and ubuntu-latest

Expected indentation of 8 spaces but found 12

Check failure on line 421 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and ubuntu-latest

Expected indentation of 8 spaces but found 12

Check failure on line 421 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and macOS-latest

Expected indentation of 8 spaces but found 12

Check failure on line 421 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and macOS-latest

Expected indentation of 8 spaces but found 12

Check failure on line 421 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and ubuntu-latest

Expected indentation of 8 spaces but found 12

Check failure on line 421 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and macOS-latest

Expected indentation of 8 spaces but found 12

Check failure on line 421 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and ubuntu-latest

Expected indentation of 8 spaces but found 12

Check failure on line 421 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and ubuntu-latest

Expected indentation of 8 spaces but found 12

Check failure on line 421 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and macOS-latest

Expected indentation of 8 spaces but found 12
}

Check failure on line 422 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 422 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and macOS-latest

Expected indentation of 6 spaces but found 8

Check failure on line 422 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and macOS-latest

Expected indentation of 6 spaces but found 8

Check failure on line 422 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 422 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 422 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and macOS-latest

Expected indentation of 6 spaces but found 8

Check failure on line 422 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and macOS-latest

Expected indentation of 6 spaces but found 8

Check failure on line 422 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 422 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and macOS-latest

Expected indentation of 6 spaces but found 8

Check failure on line 422 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 422 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 422 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and macOS-latest

Expected indentation of 6 spaces but found 8

device.on('temperature', this.onTemperature.bind(this));
device.checkTemperature();
device.on('temperature', this.onTemperature.bind(this));

Check failure on line 424 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 424 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and macOS-latest

Expected indentation of 6 spaces but found 8

Check failure on line 424 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and macOS-latest

Expected indentation of 6 spaces but found 8

Check failure on line 424 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 424 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 424 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and macOS-latest

Expected indentation of 6 spaces but found 8

Check failure on line 424 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and macOS-latest

Expected indentation of 6 spaces but found 8

Check failure on line 424 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 424 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and macOS-latest

Expected indentation of 6 spaces but found 8

Check failure on line 424 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 424 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 424 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and macOS-latest

Expected indentation of 6 spaces but found 8
device.checkTemperature();

Check failure on line 425 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 425 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and macOS-latest

Expected indentation of 6 spaces but found 8

Check failure on line 425 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and macOS-latest

Expected indentation of 6 spaces but found 8

Check failure on line 425 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 425 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 425 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and macOS-latest

Expected indentation of 6 spaces but found 8

Check failure on line 425 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and macOS-latest

Expected indentation of 6 spaces but found 8

Check failure on line 425 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 425 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 18 and macOS-latest

Expected indentation of 6 spaces but found 8

Check failure on line 425 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 425 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 20 and ubuntu-latest

Expected indentation of 6 spaces but found 8

Check failure on line 425 in accessories/aircon.js

View workflow job for this annotation

GitHub Actions / Build and Test on Node 16 and macOS-latest

Expected indentation of 6 spaces but found 8
}

this.updateTemperatureUI();
if (!config.isUnitTest) {setInterval(()=>{this.getCurrentTemperature(this.updateTemperatureUI.bind(this))}, config.temperatureUpdateFrequency * 1000)}
Expand Down

0 comments on commit 1d6cbf4

Please sign in to comment.