This is a module for the MagicMirror² to display a Nest Like thermostat from a remote sensor that is capable to POST the measured values through HTTP protocol. It is designed to be generic. Useful when having Home Assistant and Magic Mirror.
For updates, please check the CHANGELOG.
When the page load, the first state will be loading until the module receive data :
{
state: "off", // Can be any thing between : ['off', 'heating', 'cooling', 'fan', 'dry' ]
loading: true
}
Here is the state of the module when Heating with and without fan speed :
{
thermostatId: '1',
targetTemperature: 20,
ambientTemperature: 21.5,
state: "heating",
icon: "fan",
power: 3 // 0 to hide fan icon
}
Here is the state of the module when Cooling with and without fan speed :
{
thermostatId: '1',
targetTemperature: 19,
ambientTemperature: 23.5,
state: "cooling",
icon: "fan",
power: 5 // 0 to hide fan icon
}
Here is the state of the module when in Fan with and without fan speed :
{
thermostatId: '1',
targetTemperature: 21.5,
ambientTemperature: 21.5,
state: "fan",
icon: "fan",
power: 1 // 0 to hide fan icon
}
Here is the state of the module when in Dry with and without fan speed :
{
thermostatId: '1',
targetTemperature: 19.5,
ambientTemperature: 19.5,
state: "dry",
icon: "fan",
power: 4 // 0 to hide fan icon
}
If you want to see how the thermostat look like in any state or play with the configuration easily, simply download this repository localy extract it and open example/example.html
To use this module follow these steps:
- Switch to the
modules
folder of your MagicMirror
cd ~/MagicMirror/modules/
- Clone this repository to the
modules
folder
git clone https://github.com/sisimomo/MMM-NestRemoteThermostat.git
- Switch to the
MMM-NestRemoteThermostat
folder
cd ./MMM-NestRemoteThermostat/
- Install the 3rd party dependencies
npm install
- Add the following configuration block to the modules array in the
config/config.js
file:
var config = {
modules: [
{
module: 'MMM-NestRemoteThermostat',
position: 'top_right',
config: {
thermostatId: '1'
}
}
]
}
var config = {
modules: [
{
module: 'MMM-NestRemoteThermostat',
position: 'top_right',
config: {
thermostatId: '1',
minValue: 50, // Minimum value for target temperature
maxValue: 86 // Maximum value for target temperature
}
}
]
}
!! IMPORTANT !!
For security reasons the MagicMirror is not reachable externally, which also means that it does not accept data from external sources. Make sure you configure the ipWhitelist
setting in the config.js
file (see these lines in the sample config) correctly, so the remote thermostat can communicate with your mirror.
Option | Description |
---|---|
thermostatId |
REQUIRED An arbitrary value that determines from which thermostat this module accepts updates. It can also be used as an API key to restrict access to your mirror. Type: String Default value: null (must be configured) |
width |
The css width of the thermostat. Type: String Default value: '20em' |
height |
The css height of the thermostat. Type: String Default value: '20em' |
minValue |
The lowest displayable value on the dial of the thermostat. Type: Integer Default value: 10 |
maxValue |
The bigest displayable value on the dial of the thermostat. Type: Integer Default value: 30 |
numTicks |
Number of tick lines to display around the dial. Type: Integer Default value: 150 |
largeBarThickness |
Increase of size for large tick line in pixel. Type: Integer Default value: 2.5 |
iconSize |
The size in px of the fan icon. Type: Integer Default value: 50 |
targetTemperaturePrecision |
Set the level of precision for display of the target temperature. E.g., .5 will round to the nearest half degree, and 1 will round to the nearest degree. (You can set any number you want, but only one decimal place will be displayed at most.)Type: Float Default value: .5 |
ambientTemperaturePrecision |
Set the level of precision for display of the target temperature. E.g., .5 will round to the nearest half degree, and 1 will round to the nearest degree. (You can set any number you want, but only one decimal place will be displayed at most.)Type: Float Default value: .5 |
roundTargetTemperature |
DEPRECATED You should remove this from your config file if you have one set, otherwise it could override targetTemperaturePrecision . |
roundAmbientTemperature |
DEPRECATED You should remove this from your config file if you have one set, otherwise it could override ambientTemperaturePrecision . |
diameter |
The diamiter of the dial. Dosen't affect the size of the dial but the size of the elements on the dials. Type: Integer Default value: 400 |
This module creates a new HTTP endpoint on the mirror's webserver, which handles HTTP POST requests sent by the remote thermostats. The HTTP request must contain the unique identifier you assigned to the thermostat. The module displays the measured value only if the configured thermostatId
matches the value received in the request.
It is up to the thermostat to define how often it updates the measured data, the mirror will display the last received value.
This module can work with any thermostat that is capable to periodically send HTTP POST requests with the following standard JSON body to the http://<your mirror's IP>:8080/remote-nest-thermostat
endpoint:
{
thermostatId: '1',
targetTemperature: 19.5,
ambientTemperature: 19.5,
state: "dry",
icon: "fan",
power: 5,
loading: false
}
If you want, you can update only the some proprieties. To do so, only specified the proprieties you want to change. The only condition is for the propriety loading.
Make sure that your thermostat properly sets the Content-Type
header in the HTTP request to application/json
, otherwise the module will not be able to parse the request body.
Currently this module supports English (en
) and French (fr
) languages. The language can be specified in the global language
setting in the config.js
file.
Want to see more languages? Please contribute!
Your feedback is more than welcome, please send your suggestions, feature requests or bug reports as Github issues.
Many thanks to Michael Teeuw for creating and maintaining the MagicMirror² project fully open source.
Base on Magic Mirror Module: MMM-RemoteTemperature By György Balássy
Base on codepen.io example CodePen Home Nest Thermostat Control By Dal Hundal
This project is created and maintained by Simon Vallières.