From 56fc0d8f8fad66d80ec91a4f192d55954b478845 Mon Sep 17 00:00:00 2001 From: Ari Robinson Date: Sat, 14 Sep 2019 22:42:17 -0700 Subject: [PATCH 1/3] Update README.md added token in config --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 822033a..c067ccb 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ To use this module, add it to the modules array in the `config/config.js` file: host: "your_home_assistant_ip", port: "your_home_assistant_port", apipassword: "your_home_assistant_api_password", + token: "your_home_assistant_long-lived_access_token", hassiotoken: false, https: false, devices: [ From bd816304ba146ad84bce5cada65cb3416194aca7 Mon Sep 17 00:00:00 2001 From: Ari Robinson Date: Sat, 14 Sep 2019 22:50:47 -0700 Subject: [PATCH 2/3] Update node_helper.js changed "process.env.HASSIO_TOKEN" to "config.token" to pull token from config rather than process.env --- node_helper.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/node_helper.js b/node_helper.js index 1e0f35a..8dae678 100644 --- a/node_helper.js +++ b/node_helper.js @@ -127,7 +127,7 @@ module.exports = NodeHelper.create({ json: params }; if(config.hassiotoken) { - post_options.headers = { 'Authorization' : 'Bearer ' + process.env.HASSIO_TOKEN }; + post_options.headers = { 'Authorization' : 'Bearer ' + config.token }; } var post_req = request(post_options, function(error, response, body) { @@ -173,7 +173,7 @@ module.exports = NodeHelper.create({ json: true }; if(config.hassiotoken) { - get_options.headers = { 'Authorization' : 'Bearer ' + process.env.HASSIO_TOKEN }; + get_options.headers = { 'Authorization' : 'Bearer ' + config.token }; } request(get_options, function(error, response, body) { completed_requests++; From af4d7f043a8e0f12f3f1dfd6e453d7012a2ebcf8 Mon Sep 17 00:00:00 2001 From: Ari Robinson Date: Thu, 10 Oct 2019 16:00:38 -0700 Subject: [PATCH 3/3] Added prefix option --- MMM-HASS.js | 5 +++++ README.md | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/MMM-HASS.js b/MMM-HASS.js index cf82bad..72bfd41 100644 --- a/MMM-HASS.js +++ b/MMM-HASS.js @@ -123,6 +123,11 @@ Module.register('MMM-HASS', { valueWrapper.innerHTML = ''; } + // add prefix + if (self.config.devices[index].deviceReadings[indexValue].prefix) { + valueWrapper.innerHTML += self.config.devices[index].deviceReadings[indexValue].prefix; + } + valueWrapper.innerHTML += value; // add suffix diff --git a/README.md b/README.md index c067ccb..2ed62b5 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ To use this module, add it to the modules array in the `config/config.js` file: devices: [ { deviceLabel: "Exterior", deviceReadings: [ - { sensor: "sensor.netatmo_outdoor_temperature", icon: "wi wi-thermometer", suffix: "°"}, + { sensor: "sensor.netatmo_outdoor_temperature", icon: "wi wi-thermometer", prefix: "", suffix: "°"}, { sensor: "sensor.netatmo_outdoor_humidity", icon: "wi wi-humidity", suffix: "%"}, { sensor: "sensor.netatmo_outdoor_battery", icon: "fa fa-battery-full", suffix: ""} ]