Tado geolocation via Domoticz

Tado geolocation via Domoticz

December 22, 2021 0 Door Bjorn Meijer

We have been in possession of . for about a year now tado thermostatic valves and I can say that we are very satisfied with this. The advantages of the Tado thermostats are:

  • Easy installation;
  • The temperatures in each room can be set separately;
  • Easy remote control via the Tado app.
  • Thermostatic valves can be set with child lock.
  • Humidity per room is measured.
  • Climate comfort is tracked.
  • Set time schedules via the app.
  • Regular software updates with new features.
  • API functionality.

A (big) disadvantage of Tado is that you have to pay for the geolocation function. This function is included in Auto-Assist for which you have to take out a subscription. Based on geolocation, the thermostat is automatically turned off when everyone is away from home. You can enable this function for an amount of approximately € 25.00 per year. For a product where you pay quite a bit of money, I expect this to be included.

Fortunately, a plug-in has been made for Tado so that you can operate it in Domoticz. In combination with the Life360 plugin you can turn the thermostat on and off automatically via geolocation. The Github page explains how to install the Life360 plug-in in Domoticz.

Step 1 – Install the Life360 Plugin

Install the Life360 plugin. The steps for this are explained on the developer's Github page.

Step 2 – Write down the necessary Idxs from Life360

If you have installed the Life360 plug-in correctly, you will find it in the hardware overview.

Life360 Plugin Domoticz Hardware Overview
Life360 Plugin Domoticz Hardware Overview

Note the Idx of the presence (in my case 95) and of the location (96). You will need this for your dzVents script later.

Step 3 – Write down the required Idx's from Tado

Write down the Idx of light switch'heating turned on' (in my case 16) and from light switch thermostat (H). This indicates whether the thermostat is switched on manually or not. In my case this is Idx 15.

Tado Plugin Domoticz Hardware Overview
Tado Plugin Domoticz Hardware Overview

Step 4 – Let's get ready to script

Go to Settings Events.

You can now create and modify scripts via the web environment to control devices in Domoticz.
click on dzVents Device.

Domoticz dzVents
Domoticz dzVents – create new script

You should now see the code below in the text editing area of your screen.

return { on = { devices = { 'myDevice' } }, logging = { level = domoticz.LOG_INFO, marker = 'template', }, execute = function(domoticz, device) domoticz.log('Device ' .. device. name .. ' was changed', domoticz.LOG_INFO) end }

Adjust the script to the script below.

return {
	on = {
		devices = {
			[95] = { 'between 07:00 and 22:00' }
		},
	},
	execute = function(domoticz, device)
	    if domoticz.devices(95)._state == 'Off' then
	        domoticz.devices(16).switchOff()    -- Vorstbeveiliging ingeschakeld
	    else 
            domoticz.devices(16).switchOn()     -- Vorstbeveiliging uitgeschakeld
	    end

    domoticz.log(domoticz.devices(96).name .. " is bij " .. domoticz.devices(96).state, domoticz.LOG_INFO)
    domoticz.log("Thermostaat woonkamer is ingesteld op " .. domoticz.devices(43)._state .. "ºC", domoticz.LOG_INFO)
	end
}

Step 5 – Explanation of the script

The script is structured as follows.

[95] = { 'between 07:00 and 22:00' }

Of { 'between 07:00 and 22:00' } is subject to the condition that it is valid between 07:00 and 22:00. The device with Idx 95 is the switch of the Life360 plug-in which indicates whether you are at home (On) or not (Off). Enter the Idx from step 2 here.

If all conditions are met, the rest of the script will be executed.

	execute = function(domoticz, device) if domoticz.devices(95)._state == 'Off' then domoticz.devices(16).switchOff() -- Frost protection enabled else domoticz.devices(16).switchOn() -- Frost protection disabled end

The condition if domoticz.devices(95)._state == 'Off' then checks whether Life360 indicates whether you are at home (On) or not (Off). If you are not at home, the command domoticz.devices(16).switchOff() the heating is turned off. Substitute the 16 for the Idx you wrote down in step 3.
If you are at home, or if you come home, the heating will be switched on again with the command domoticz.devices(16).switchOn().

domoticz.log(domoticz.devices(96).name .. " is at " .. domoticz.devices(96).state, domoticz.LOG_INFO) domoticz.log("Living room thermostat is set to " .. domoticz.devices( 43)._state .. "ºC", domoticz.LOG_INFO)

domoticz.log(domoticz.devices(96).name .. " is at " .. domoticz.devices(96).state, domoticz.LOG_INFO) indicates in the log where the user is currently located. Change Idx 96 to the Idx you wrote down in step 2.

domoticz.log("Living room thermostat is set to " .. domoticz.devices(43)._state .. "ºC", domoticz.LOG_INFO) indicates what the thermostat is set to. Adjust Idx 43 to the Idx from step 3.