[IFTTT] Determining if tado is in Home or Away mode

Without consuming a tado trigger, the following filter code can determine if your system is in Away or Home mode by just querying the last switch to Home and the last one to Away. I wrote this because I did not find any available variable from the tado triggers/queries. I use it to skip heating up early if the system is in Away mode, because I don't know whether the Action will be ignoring the Away mode. You can of course use it in other contexts too.


var dateTadoSwitchedAway = new Date("")

var dateTadoSwitchedHome = new Date("")

var tadoIsInAwayMode = false

var switchAway

var switchHome


if ( switchAway = TadoHeating.historyOfTadoSwitchingToAwayMode[0] ){

 dateTadoSwitchedAway = new Date(switchAway.SwitchedAt)

 if ( switchHome = TadoHeating.historyOfTadoSwitchesToHomeMode[0] ){

  dateTadoSwitchedHome = new Date(switchHome.SwitchedAt)

  tadoIsInAwayMode = ( dateTadoSwitchedAway.getTime() > dateTadoSwitchedHome.getTime() ) // if it switched Away more recently than it switched home, we assume it is Away mode.

 }else{

  // object historyOfTadoSwitchesToHomeMode null

  tadoIsInAwayMode = true

 }

}else{

 // object historyOfTadoSwitchingToAwayMode null

 // tadoIsInAwayMode can remain false

}


If anyone knows whether a tado Action is always ignored when the system is in Away mode, thanks for commenting below.

1
1 votes

Active · Last Updated