Skip to content

Commit

Permalink
Merge pull request #18 from maxlapides/master
Browse files Browse the repository at this point in the history
fix: typos
  • Loading branch information
haywirecoder authored Jul 26, 2024
2 parents f42f653 + 7368a38 commit 49f9452
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
20 changes: 10 additions & 10 deletions accessories/waterSensor.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ class FloWaterSensor {
this.Service = Service;
this.serialNumber = device.serialNumber;
this.model = device.deviceModel;
this.surpressNoticationFlag = config.surpressWaterNotification || false;
this.suppressNoticationFlag = config.surpressWaterNotification || false;
this.log = log;
this.name = device.name;
this.version = device.version;
this.currentTemperature = device.temperature || -180;
this.currentHumidity = device.humidity || 0.0;
this.leakDected = false;
this.leakDetected = false;
this.isConnected = device.isConnected;
this.batteryLevel = device.batterylevel || 0;
this.IsTemperatureAndHumidity = config.showTemperatureAndHumidity ?? true;
Expand All @@ -30,7 +30,7 @@ class FloWaterSensor {
this.currentTemperature = eventData.device.temperature || -180;
this.currentHumidity = eventData.device.humidity || 0.0;
this.batteryLevel = eventData.device.batterylevel || 0;
var leakdectedOnCritical = false;
var leakDetectedOnCritical = false;

// Is device offline?
if ((eventData.device.offline != 0 ) || (eventData.device.isConnected == false ))
Expand All @@ -39,19 +39,19 @@ class FloWaterSensor {
this.systemTampered = this.Characteristic.StatusTampered.NOT_TAMPERED;

// Should leak clear once water is not longer detect ?
if (this.surpressNotication == false)
if(eventData.device.notifications.criticalCount > 0) leakdectedOnCritical = true;
if (this.suppressNoticationFlag == false)
if(eventData.device.notifications.criticalCount > 0) leakDetectedOnCritical = true;

// get the leak sensor service to update status
const leakService = this.accessory.getService(this.Service.LeakSensor);
if((leakdectedOnCritical) || (eventData.device.waterdetect))
if(leakDetectedOnCritical || eventData.device.waterdetect)
{
this.leakDected = true;
this.leakDetected = true;
leakService.updateCharacteristic(this.Characteristic.LeakDetected, this.Characteristic.LeakDetected.LEAK_DETECTED);
leakService.updateCharacteristic(this.Characteristic.StatusTampered, this.systemTampered);
}
else {
this.leakDected = false;
this.leakDetected = false;
leakService.updateCharacteristic(this.Characteristic.LeakDetected, this.Characteristic.LeakDetected.LEAK_NOT_DETECTED);
leakService.updateCharacteristic(this.Characteristic.StatusTampered, this.systemTampered);
}
Expand All @@ -61,7 +61,7 @@ class FloWaterSensor {
this.accessory = accessory;
this.accessory.getService(this.Service.AccessoryInformation)
.setCharacteristic(this.Characteristic.Manufacturer, 'Moen')
.setCharacteristic(this.Characteristic.Model, 'Water Sesnor ' + this.model)
.setCharacteristic(this.Characteristic.Model, 'Water Sensor ' + this.model)
.setCharacteristic(this.Characteristic.SerialNumber, this.serialNumber)
.setCharacteristic(this.Characteristic.FirmwareRevision, this.version);

Expand Down Expand Up @@ -116,7 +116,7 @@ class FloWaterSensor {
}

async getLeakStatus(callback) {
if (this.leakDected)
if (this.leakDetected)
{
return callback(null, this.Characteristic.LeakDetected.LEAK_DETECTED);
} else {
Expand Down
4 changes: 2 additions & 2 deletions flomain.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class FlobyMoem extends EventEmitter {
// Set timer to obtain new token
var refreshTimeoutmillis = Math.floor(this.auth_token.expiry - Date.now());
// Display refreshing token information
this.log.info(`Flo Info: Token will refresh in ${Math.floor((refreshTimeoutmillis / (1000 * 60 * 60)) % 24)} hour(s) and ${Math.floor((refreshTimeoutmillis / (1000 * 60 )) % 60)} mins(s).`);
this.log.info(`Flo Info: Token will refresh in ${Math.floor((refreshTimeoutmillis / (1000 * 60 * 60)) % 24)} hour(s) and ${Math.floor((refreshTimeoutmillis / (1000 * 60 )) % 60)} min(s).`);
return true;

}
Expand Down Expand Up @@ -533,7 +533,7 @@ class FlobyMoem extends EventEmitter {
}
catch(err) {
// At times the plug-in reports a 502 error. This is a communication error with the Flo server,
// an occasional error will not effect operations, surpress unless it occuring frequenctly.
// an occasional error will not effect operations, suppress unless it is occurring frequently.
if(err.response.status == 502)
{
this.flo_devices[deviceIndex].errorCount += 1;
Expand Down

0 comments on commit 49f9452

Please sign in to comment.