Skip to content

Commit

Permalink
Adressing issue number #1. (#2)
Browse files Browse the repository at this point in the history
Updating javascript code to ES6.
  • Loading branch information
sisimomo authored Aug 15, 2021
1 parent 0421c16 commit 065e66d
Show file tree
Hide file tree
Showing 7 changed files with 486 additions and 452 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
All notable changes to this project is documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [1.1.0]

Update js code to ES6. Correction of some small details.

## [1.0.0]

First public release.
31 changes: 17 additions & 14 deletions MMM-NestRemoteThermostat.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ Module.register('MMM-NestRemoteThermostat', {

getScripts() {
return [
this.file('thermostatDial.js')
this.file('NestThermostat.js')
];
},

getStyles() {
return [
this.file('thermostatDial.css')
this.file('NestThermostat.css')
];
},

Expand All @@ -59,30 +59,33 @@ Module.register('MMM-NestRemoteThermostat', {
if (this.thermostat) {

if (this.newValues.targetTemperature) {
this.thermostat.targetTemperature = this.newValues.targetTemperature;
this.thermostat.setTargetTemperature(this.newValues.targetTemperature);
}
if (this.newValues.ambientTemperature) {
this.thermostat.ambientTemperature = this.newValues.ambientTemperature;
this.thermostat.setAmbientTemperature(this.newValues.ambientTemperature);
}
if (this.newValues.hvacState) {
this.thermostat.hvacState = this.newValues.hvacState;
this.thermostat.setHvacState(this.newValues.hvacState);
}
if (this.newValues.fanSpeed) {
this.thermostat.fanSpeed = this.newValues.fanSpeed;
this.thermostat.setFanSpeed(this.newValues.fanSpeed);
}
if (this.newValues.loading) {
this.thermostat.loading = this.newValues.loading;
this.thermostat.setLoading(this.newValues.loading);
}
this.newValues = {};
} else {
this.thermostatDiv = document.createElement('div');

const translateLocal = (str) => {
return this.translate(str);
}

this.thermostat = new thermostatDial(this.thermostatDiv, translateLocal, this.config, {
fanSpeeds: [ './modules/MMM-NestRemoteThermostat/images/fanIconSpeed1.gif', './modules/MMM-NestRemoteThermostat/images/fanIconSpeed2.gif', './modules/MMM-NestRemoteThermostat/images/fanIconSpeed3.gif', './modules/MMM-NestRemoteThermostat/images/fanIconSpeed4.gif', './modules/MMM-NestRemoteThermostat/images/fanIconSpeed5.gif' ],
this.thermostat = new NestThermostat({
targetElement: this.thermostatDiv,
translateFn: (str) => {
return this.translate(str);
},
options: this.config,
properties: {
fanSpeeds: [ this.file('/images/fanIconSpeed1.gif'), this.file('/images/fanIconSpeed2.gif'), this.file('/images/fanIconSpeed3.gif'), this.file('/images/fanIconSpeed4.gif'), this.file('/images/fanIconSpeed5.gif') ],
}
});

this.thermostatDiv.style.width = this.config.width;
Expand All @@ -102,7 +105,7 @@ Module.register('MMM-NestRemoteThermostat', {
fanSpeed: payload.fanSpeed,
loading: payload.loading
};
Log.info('MMM-NestRemoteThermostat with thermostatId: "' + this.config.thermostatId + '" just receive new values.', this.newValues);
Log.info('MMM-NestRemoteThermostat, thermostatId: "' + this.config.thermostatId + '" just receive new values.', this.newValues);

this.updateDom();
}
Expand Down
File renamed without changes.
Loading

0 comments on commit 065e66d

Please sign in to comment.