Node Red, MQTT and Tado

I use Node Red and MQTT around the house for a simple home automation system. After getting Tado installed, I wondered how easy it would be to link it in. Actually, it is very easy:

image

This flow pulls info from the Tado site every minute and creates MQTT messages for my other flows to pick up. As I have other wireless temperature nodes around the house, I could spot that the heating is on and a window is open by looking at temperature differences around the house.

For the HTTP Request node:

image

Text:

https://my.tado.com/mobile/1.4/getCurrentState?username=USERNAME&password=PASSWORD

 

And the Function Node

These were the items I was interested in. There are others available, type the HTTP Request line into your web browser to see them all.

image

Text:

if (msg.payload === “” ) {
return null;
}
var tado = JSON.parse(msg.payload);
context.global.tadotemp = tado.insideTemp.toFixed(1);
msg1 = {topic:“House/Tado/insideTemp”,payload:context.global.tadotemp};
msg2 ={topic:“House/Tado/operation”,payload:context.global.tadooperation};
msg3 = {topic:“House/Tado/operationTrigger”,payload:tado.operationTrigger};

msg4 = {topic:“House/Tado/setPointTemp”,payload:tado.setPointTemp};
context.global.tadocontrolphase = tado.controlPhase;
msg5 = {topic:“House/Tado/controlPhase”,payload:context.global.tadocontrolphase};
return [msg1, msg2, msg3, msg4, msg5];

The extra function node “Add Tado Temp…” just takes the Tado Temperature and adds it to another Topic

The Debug output is shown below:

image

Hope that this is useful!

Tony

Leave a Reply

Your email address will not be published.