Read the statement by Michael Teeuw here.
MMM-Tado wrong units
-
@sdetweil I disagree, it is unclear if the current config is not working or if he wanted a custom units setting for the app. @Stoffbeuteluwe Can you clarify if you wanted to set a different unit for the app?
-
@WouterEekhout I am from Germany and I need metric unit but Sam helped me to fix and now it’s working for me.
It would be cool to have the choice in module config. Metric or imperial
Thanks to you guys -
@Stoffbeuteluwe what is your main config.js units set to? up near address:
-
@sdetweil it is metric
-
@Stoffbeuteluwe so, the original code should have worked…
-
@sdetweil without your fix it does not work in my case
-
-
@sdetweil Hello, after module update same problem
and your fix don’t work anymore…can you help me again?var config = { address: "0.0.0.0", // Address to listen on, can be: // - "0.0.0.0", "127.0.0.1", "::1" to listen on loopback interface // - another specific IPv4/6 to listen on a specific interface // - "", "0.0.0.0", "::" to listen on any interface // Default, when address config is left out, is "0.0.0.0" port: 8080, ipWhitelist: [], // Set [] to allow all IP addresses // or add a specific IPv4 of 192.168.1.5 : // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"], // or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format : // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"], language: "de", timeFormat: 24, units: "metric", modules: [
-
@Stoffbeuteluwe ok, need an editor for this…
line 26 of MMM-Tado.js, leave alone
change all the other this.config.units to self.config.units
change them all, then change line 26 back to this.
I have opened issue 11
https://github.com/WouterEekhout/MMM-Tado/issues/11 -
@sdetweil no luck…sorry, I have changed 4x this into self
but I am not sure with the line 26/** * Created by Wouter Eekhout on 06/01/2017. */ Module.register("MMM-Tado", { // Default module config. defaults: { username: '', password: '', updateInterval: 300000, }, tadoMe: {}, tadoHomes: [], getStyles: function () { return [ this.file('css/MMM-Tado.css'), ]; }, start: function () { if (this.config.updateInterval < this.defaults.updateInterval){ this.config.updateInterval = this.defaults.updateInterval; } this.config.units = self.config.units; this.sendSocketNotification('CONFIG', this.config); }, // Override dom generator. getDom: function () { let self = this; let wrapper = document.createElement("div"); wrapper.className = "tado-info"; this.tadoHomes.forEach(home => { let homeWrapper = document.createElement("div"); homeWrapper.className = "tado-home"; let logoWrapper = document.createElement("i"); logoWrapper.className = "tado-icon-tado_logo tado-logo"; homeWrapper.appendChild(logoWrapper); let tableWrapper = document.createElement("table"); tableWrapper.className = "tado-table small"; home.zones.forEach(zone => { let rowWrapper = document.createElement("tr"); if (zone.type === "HOT_WATER") { let firstTableDataWrapper = document.createElement("td"); firstTableDataWrapper.className = "tado-table-name"; let zoneNameWrapper = document.createElement("span"); zoneNameWrapper.innerText = zone.name; firstTableDataWrapper.appendChild(zoneNameWrapper); rowWrapper.appendChild(firstTableDataWrapper); let secondTableDateWrapper = document.createElement("td"); secondTableDateWrapper.className = "tado-table-data"; let temperatureWrapper = document.createElement("span"); let temperatureIconWrapper = document.createElement("i"); temperatureIconWrapper.className = "fa fa-thermometer-half"; temperatureWrapper.appendChild(temperatureIconWrapper); if (zone.state.setting.temperature == null) { var temperatureTextWrapper = document.createTextNode(zone.state.setting.power); } else { if (self.config.units === "metric") { var temperatureTextWrapper = document.createTextNode(zone.state.setting.temperature.celsius + "°"); } else { var temperatureTextWrapper = document.createTextNode(zone.state.setting.temperature.fahrenheit + "°"); } } temperatureWrapper.appendChild(temperatureTextWrapper); secondTableDateWrapper.appendChild(temperatureWrapper); rowWrapper.appendChild(secondTableDateWrapper); } else if (zone.type === "HEATING") { let firstTableDataWrapper = document.createElement("td"); firstTableDataWrapper.className = "tado-table-name"; let zoneNameWrapper = document.createElement("span"); zoneNameWrapper.innerText = zone.name; firstTableDataWrapper.appendChild(zoneNameWrapper); rowWrapper.appendChild(firstTableDataWrapper); let secondTableDateWrapper = document.createElement("td"); secondTableDateWrapper.className = "tado-table-data"; //current temperature let temperatureWrapper = document.createElement("span"); temperatureWrapper.className = "bright"; let temperatureIconWrapper = document.createElement("i"); temperatureIconWrapper.className = "fa fa-thermometer-half"; temperatureWrapper.appendChild(temperatureIconWrapper); if (self.config.units === "metric") { var temperatureTextWrapper = document.createTextNode(zone.state.sensorDataPoints.insideTemperature.celsius + "°"); } else { var temperatureTextWrapper = document.createTextNode(zone.state.sensorDataPoints.insideTemperature.fahrenheit + "°"); } temperatureWrapper.appendChild(temperatureTextWrapper); if (zone.state.activityDataPoints.heatingPower.percentage > 0) { //The zone is heating let heatingWrapper = document.createElement("i"); heatingWrapper.className = "fa fa-fire bright"; temperatureWrapper.appendChild(heatingWrapper); } secondTableDateWrapper.appendChild(temperatureWrapper); //target temperature let temperatureTargetWrapper = document.createElement("span"); temperatureTargetWrapper.className = "xsmall"; let temperatureTargetIconWrapper = document.createElement("i"); temperatureTargetIconWrapper.className = "fa fa-thermometer-half"; temperatureTargetWrapper.appendChild(temperatureTargetIconWrapper); if (zone.state.setting.temperature == null) { var temperatureTargetTextWrapper = document.createTextNode(zone.state.setting.power); } else { if (self.config.units === "metric") { var temperatureTargetTextWrapper = document.createTextNode(zone.state.setting.temperature.celsius + "°"); } else { var temperatureTargetTextWrapper = document.createTextNode(zone.state.setting.temperature.fahrenheit + "°"); } } temperatureTargetWrapper.appendChild(temperatureTargetTextWrapper); secondTableDateWrapper.appendChild(temperatureTargetWrapper); let breakLine = document.createElement("br"); secondTableDateWrapper.appendChild(breakLine); let humidityWrapper = document.createElement("span"); let humidityIconWrapper = document.createElement("i"); humidityIconWrapper.className = "fa fa-tint"; humidityWrapper.appendChild(humidityIconWrapper); let humidityTextWrapper = document.createTextNode(zone.state.sensorDataPoints.humidity.percentage + "%"); humidityWrapper.appendChild(humidityTextWrapper); secondTableDateWrapper.appendChild(humidityWrapper); rowWrapper.appendChild(secondTableDateWrapper); } else if (zone.type === "AIR_CONDITIONING") { let firstTableDataWrapper = document.createElement("td"); firstTableDataWrapper.className = "tado-table-name"; let zoneNameWrapper = document.createElement("span"); zoneNameWrapper.innerText = zone.name; firstTableDataWrapper.appendChild(zoneNameWrapper); rowWrapper.appendChild(firstTableDataWrapper); let secondTableDateWrapper = document.createElement("td"); secondTableDateWrapper.className = "tado-table-data"; //current temperature let temperatureWrapper = document.createElement("span"); temperatureWrapper.className = "bright"; let temperatureIconWrapper = document.createElement("i"); temperatureIconWrapper.className = "fa fa-thermometer-half"; temperatureWrapper.appendChild(temperatureIconWrapper); if (self.config.units === "metric") { var temperatureTextWrapper = document.createTextNode(zone.state.sensorDataPoints.insideTemperature.celsius + "°"); } else { var temperatureTextWrapper = document.createTextNode(zone.state.sensorDataPoints.insideTemperature.fahrenheit + "°"); } temperatureWrapper.appendChild(temperatureTextWrapper); if (zone.state.setting.mode === "HEAT") { //The zone is heating let heatingWrapper = document.createElement("i"); heatingWrapper.className = "fa fa-fire bright"; temperatureWrapper.appendChild(heatingWrapper); } else if (zone.state.setting.mode === "COOL") { //The zone is cooling let coolingWrapper = document.createElement("i"); coolingWrapper.className = "fa fa-snowflake bright"; temperatureWrapper.appendChild(coolingWrapper); } secondTableDateWrapper.appendChild(temperatureWrapper); //target temperature let temperatureTargetWrapper = document.createElement("span"); temperatureTargetWrapper.className = "xsmall"; let temperatureTargetIconWrapper = document.createElement("i"); temperatureTargetIconWrapper.className = "fa fa-thermometer-half"; temperatureTargetWrapper.appendChild(temperatureTargetIconWrapper); if (zone.state.setting.temperature == null) { var temperatureTargetTextWrapper = document.createTextNode(zone.state.setting.power); } else { if (self.config.units === "metric") { var temperatureTargetTextWrapper = document.createTextNode(zone.state.setting.temperature.celsius + "°"); } else { var temperatureTargetTextWrapper = document.createTextNode(zone.state.setting.temperature.fahrenheit + "°"); } } temperatureTargetWrapper.appendChild(temperatureTargetTextWrapper); secondTableDateWrapper.appendChild(temperatureTargetWrapper); let breakLine = document.createElement("br"); secondTableDateWrapper.appendChild(breakLine); let humidityWrapper = document.createElement("span"); let humidityIconWrapper = document.createElement("i"); humidityIconWrapper.className = "fa fa-tint"; humidityWrapper.appendChild(humidityIconWrapper); let humidityTextWrapper = document.createTextNode(zone.state.sensorDataPoints.humidity.percentage + "%"); humidityWrapper.appendChild(humidityTextWrapper); secondTableDateWrapper.appendChild(humidityWrapper); rowWrapper.appendChild(secondTableDateWrapper); } else { //don't add it return; } tableWrapper.appendChild(rowWrapper); }); homeWrapper.appendChild(tableWrapper); wrapper.appendChild(homeWrapper); }); return wrapper; }, socketNotificationReceived: function(notification, payload) { if (notification === 'NEW_DATA') { this.tadoMe = payload.tadoMe; this.tadoHomes = payload.tadoHomes; this.updateDom(); } } });