derekoharrow / domoticz-tado-user-geolocation

User based geolocation for Tado
0 stars 0 forks source link
domoticz home-automation tado

domoticz-tado-user-geolocation

Introduction

This set of scripts implements a capability that Tado users have been wanting for quite some time - the ability to have per-user geolocation and turn on/off heating for specific zones for specific users based on whether they are home or not.

Limitations

To-Do

Pre-requisites

User Variables

The following Domoticzz User Variables must be set in order for these scripts to work:

Global Data

Instructions

  1. Create the Domoticz User Variables TadoUsername and TadoPassword as Strings and set them to your Tado credentials.
  2. Create the Domoticz User Variable TadoAwayTemp as an Integer and set it to your desired away temp (in Celsius)
  3. Copy the data values from the enclosed global_data.lua and merge it into your global_data.lua in domoticz/scripts/dzvents
  4. Edit the TadoUserMapping parameter in global_data.lua to map users to the zone you want to control for each of them. You must use the user names and zone names as they appear in Tado here.
  5. Copy the rest of the LUA files into your domoticz/scripts/dzvents folder
  6. (Optional) turn on debugging in each LUA file by uncommenting the debug level in the logging section at the start of each script.

Scripts

global_data.lua

The content of the enclosed global_data.lua must be added to your existing global_data.lua stored in domoticz/scripts/dzvents

tado-auth.lua

This script regularly calls the Tado API to authenticate and retrieve an authentication token, which expires every 10 minutes. To ensure the token doesn't expire, this script runs every 6 minutes.

tado-gethomeid.lua

Calls the Tado API to get the HomeID of your Tado setup (every home on Tado has a unique HomeID)

tado-getstatus.lua

Calls the Tado API multiple times to get:

tado-userzones.lua

This is the main script that processes the information retrieved by the other scripts.

For each user in the retrieved user list, it checks those users against the mapped zones and when a match is found it will:

The key to this is the mapping of users to managed zones, which is defined in global_data.lua by the variable TadoUserMapping.