mattdavis90 / node-red-contrib-tado-client

Tado web API client node for Node Red
MIT License
20 stars 16 forks source link

Tado Web API Node with shared config

A Node-RED node with the shared configuration that lets you connect to the Tado Web API.

Please note: The library used by this node is derived from reverse engineering the Tado Web API and hence may be unstable.

[!IMPORTANT] From v0.9.0 onward this node requires at least nodejs v12 due to using async functions.

Installation

Node-RED Palette (Preferred)

You can install the node from the built-in Node-RED palette. It is available on the menu in the top-right corner of Node-RED, under the "Manage Palette" option; search for tado.

Using NPM

Run the following command in the root directory of your Node-RED install or home directory (usually ~/.node-red) and will also install needed libraries.

npm install node-red-contrib-tado-client

Getting Started

Install the Example Flow

There is an example flow available in the repo. I'd recommend giving it a go to trial the functionality available. Link to example

Link to Node-RED documenation on import/export

The example can be installed from the Node-RED menu in the top-right, then choose "Import", and paste the JSON from the example into the box. It is a good idea to change the target to "New Flow" so you don't override any of your existing nodes. Once imported make sure to deploy the changes.

Configure the Node

Open the Tado configuration node by selecting the Node-RED menu and choosing "Configuration Nodes" then double clicking the "Tado Config" node in the righthand sidebar. This will open the configuration window, here you can enter your Tado username and password, click update to save. You can then press deploy to update your Node-RED.

Find your home_id

In order to use most API calls you'll need to know your Tado home_id. This can be found using the first example (getMe) from the example flow. Make sure you've done the previous step and click the inject button to the left of the getMe node. You should see your home_id in the debug message pane on the righthand side. You can now edit other Tado nodes to include this home_id value.

Going further

You can create multiple Tado nodes, each of which interacts with a single end-point on the Tado API. Many are demoed in the example.

The node is triggered by each message on the input, regardless of content. This allows creating flows using other nodes to trigger the API. If the message on the input contains any of the following fields then they will ovewrite the properties on the node.

[!NOTE] For AC users - Tado changed from FanSpeed to FanLevel. If you zone shows FanLevel then please use Level1, Level2, etc. as the FanSpeed parameter, otherwise use High, Medium, Low.

The response from the Tado API is represented in msg.payload and the generating API call is msg.topic.

Advanced Usage

It is now possible to make API calls that aren't in the list above but that have been implemented in the underlying library.

This can be done by injecting a msg.apiCall with the function name and a msg.payload with an array of arguments.

For instance to call the clearZoneOverlays API as defined here but not yet exposed in Node-RED, you could do the following.

Other available apiCalls can be found by reading the library documenation but some noteworthy calls are:

Examples of using this advanced functionality can be found in the examples here

Credits

This node is based on the work of SCPhillips