Domoticz: Tado hardware mixes up thermostats setpoints

Created on 29 Nov 2019  路  20Comments  路  Source: domoticz/domoticz

Hi,

I am reporting an issue with the Tado Hardware plugin which behaves abnormally with the Thermostats SetPoints.

I am running Domoticz v4.10717 on a Raspberry Pi 2 (Raspbian Stretch).
The issue appeared after I added a 4th thermostat to the Tado application.
I tried to disable/delete/add the plugin several times, remove and add again the thermostat from the Tado application. The issue is persisting.

The issue is that when changing the SetPoint of one particular thermostat, it changes the SetPoint of another thermostat instead. Please find a video of the issue here: https://youtu.be/Igpc_2yKhD4

Along with the logs from Domoticz at the same time:

2019-11-29 23:18:11.271 (Tado) Thermostat (Home Cuisine Setpoint)
2019-11-29 23:18:11.276 (Tado) Temp + Humidity (Home Cuisine TempHum)
2019-11-29 23:18:11.281 (Tado) General/Percentage (Home Cuisine Heating Power)
2019-11-29 23:18:11.263 Debug: SQLH UpdateValueInt Home Cuisine Setpoint HwID:9 DevID:000002E Type:242 sType:1 nValue:0 sValue:20.00
2019-11-29 23:18:11.275 Debug: SQLH UpdateValueInt Home Cuisine TempHum HwID:9 DevID:303 Type:82 sType:5 nValue:0 sValue:20.2;51;1
2019-11-29 23:18:11.280 Debug: SQLH UpdateValueInt Home Cuisine Heating Power HwID:9 DevID:00000133 Type:243 sType:6 nValue:0 sValue:0.00
2019-11-29 23:18:27.541 Tado: SetSetpoint() called with idx=46, temp=17.000000
2019-11-29 23:18:27.541 Tado: CreateOverlay() called with idx=46, temp=17.000000, termination type=TADO_MODE

2019-11-29 23:18:29.330 (Tado) Thermostat (Home Chambre Setpoint)
2019-11-29 23:18:29.335 (Tado) Temp + Humidity (Home Chambre TempHum)
2019-11-29 23:18:29.346 (Tado) General/Percentage (Home Chambre Heating Power)
2019-11-29 23:18:29.325 Debug: SQLH UpdateValueInt Home Chambre Setpoint HwID:9 DevID:0000002 Type:242 sType:1 nValue:0 sValue:17.00
2019-11-29 23:18:29.333 Debug: SQLH UpdateValueInt Home Chambre TempHum HwID:9 DevID:3 Type:82 sType:5 nValue:0 sValue:19.7;61;3
2019-11-29 23:18:29.345 Debug: SQLH UpdateValueInt Home Chambre Heating Power HwID:9 DevID:00000007 Type:243 sType:6 nValue:0 sValue:52.00
2019-11-29 23:18:39.162 Tado: SetSetpoint() called with idx=2, temp=22.000000
2019-11-29 23:18:39.162 Tado: CreateOverlay() called with idx=2, temp=22.000000, termination type=TADO_MODE

2019-11-29 23:18:40.945 (Tado) Thermostat (Home Chambre Setpoint)
2019-11-29 23:18:40.953 (Tado) Temp + Humidity (Home Chambre TempHum)
2019-11-29 23:18:40.965 (Tado) Lighting 2 (Home Chambre Heating On)
2019-11-29 23:18:40.968 (Tado) General/Percentage (Home Chambre Heating Power)
2019-11-29 23:18:40.940 Debug: SQLH UpdateValueInt Home Chambre Setpoint HwID:9 DevID:0000002 Type:242 sType:1 nValue:0 sValue:22.00
2019-11-29 23:18:40.949 Debug: SQLH UpdateValueInt Home Chambre TempHum HwID:9 DevID:3 Type:82 sType:5 nValue:0 sValue:19.8;61;3
2019-11-29 23:18:40.968 Debug: SQLH UpdateValueInt Home Chambre Heating Power HwID:9 DevID:00000007 Type:243 sType:6 nValue:0 sValue:0.00
2019-11-29 23:18:42.938 (Tado) Thermostat (Home Chambre Setpoint)
2019-11-29 23:18:42.943 (Tado) Temp + Humidity (Home Chambre TempHum)
2019-11-29 23:18:42.948 (Tado) General/Percentage (Home Chambre Heating Power)
2019-11-29 23:18:42.932 Debug: SQLH UpdateValueInt Home Chambre Setpoint HwID:9 DevID:0000002 Type:242 sType:1 nValue:0 sValue:22.00
2019-11-29 23:18:42.941 Debug: SQLH UpdateValueInt Home Chambre TempHum HwID:9 DevID:3 Type:82 sType:5 nValue:0 sValue:19.8;61;3
2019-11-29 23:18:42.947 Debug: SQLH UpdateValueInt Home Chambre Heating Power HwID:9 DevID:00000007 Type:243 sType:6 nValue:0 sValue:0.00
2019-11-29 23:18:43.771 (Tado) Thermostat (Home Chambre Achilles Setpoint)
2019-11-29 23:18:43.778 (Tado) Temp + Humidity (Home Chambre Achilles TempHum)
2019-11-29 23:18:43.781 (Tado) General/Percentage (Home Chambre Achilles Heating Power)
2019-11-29 23:18:43.766 Debug: SQLH UpdateValueInt Home Chambre Achilles Setpoint HwID:9 DevID:0000066 Type:242 sType:1 nValue:0 sValue:19.00
2019-11-29 23:18:43.776 Debug: SQLH UpdateValueInt Home Chambre Achilles TempHum HwID:9 DevID:103 Type:82 sType:5 nValue:0 sValue:19.5;58;1
2019-11-29 23:18:43.781 Debug: SQLH UpdateValueInt Home Chambre Achilles Heating Power HwID:9 DevID:0000006B Type:243 sType:6 nValue:0 sValue:0.00
2019-11-29 23:18:44.628 (Tado) Thermostat (Home Salon Setpoint)
2019-11-29 23:18:44.639 (Tado) Temp + Humidity (Home Salon TempHum)
2019-11-29 23:18:44.642 (Tado) General/Percentage (Home Salon Heating Power)
2019-11-29 23:18:44.623 Debug: SQLH UpdateValueInt Home Salon Setpoint HwID:9 DevID:00000CA Type:242 sType:1 nValue:0 sValue:20.00
2019-11-29 23:18:44.639 Debug: SQLH UpdateValueInt Home Salon TempHum HwID:9 DevID:203 Type:82 sType:5 nValue:0 sValue:22.5;50;1
2019-11-29 23:18:44.641 Debug: SQLH UpdateValueInt Home Salon Heating Power HwID:9 DevID:000000CF Type:243 sType:6 nValue:0 sValue:0.00
2019-11-29 23:18:45.460 (Tado) Thermostat (Home Cuisine Setpoint)
2019-11-29 23:18:45.468 (Tado) Temp + Humidity (Home Cuisine TempHum)
2019-11-29 23:18:45.472 (Tado) Lighting 2 (Home Cuisine Heating On)
2019-11-29 23:18:45.474 (Tado) General/Percentage (Home Cuisine Heating Power)
2019-11-29 23:18:45.456 Debug: SQLH UpdateValueInt Home Cuisine Setpoint HwID:9 DevID:000002E Type:242 sType:1 nValue:0 sValue:20.00
2019-11-29 23:18:45.465 Debug: SQLH UpdateValueInt Home Cuisine TempHum HwID:9 DevID:303 Type:82 sType:5 nValue:0 sValue:20.2;51;1
2019-11-29 23:18:45.473 Debug: SQLH UpdateValueInt Home Cuisine Heating Power HwID:9 DevID:00000133 Type:243 sType:6 nValue:0 sValue:11.00
2019-11-29 23:18:46.925 Tado: SetSetpoint() called with idx=46, temp=16.000000
2019-11-29 23:18:46.925 Tado: CreateOverlay() called with idx=46, temp=16.000000, termination type=TADO_MODE

2019-11-29 23:18:48.790 (Tado) Thermostat (Home Chambre Setpoint)
2019-11-29 23:18:48.804 (Tado) Temp + Humidity (Home Chambre TempHum)
2019-11-29 23:18:48.810 (Tado) Lighting 2 (Home Chambre Heating On)
2019-11-29 23:18:48.813 (Tado) General/Percentage (Home Chambre Heating Power)
2019-11-29 23:18:48.784 Debug: SQLH UpdateValueInt Home Chambre Setpoint HwID:9 DevID:0000002 Type:242 sType:1 nValue:0 sValue:16.00
2019-11-29 23:18:48.803 Debug: SQLH UpdateValueInt Home Chambre TempHum HwID:9 DevID:3 Type:82 sType:5 nValue:0 sValue:19.8;61;3
2019-11-29 23:18:48.813 Debug: SQLH UpdateValueInt Home Chambre Heating Power HwID:9 DevID:00000007 Type:243 sType:6 nValue:0 sValue:100.00
2019-11-29 23:18:57.321 (Nest Thermostat) Thermostat (Thermostat Nest)
2019-11-29 23:18:57.333 (Nest Thermostat) Temp + Humidity (Temp茅rature Nest)
2019-11-29 23:18:57.317 Debug: SQLH UpdateValueInt Thermostat Nest HwID:3 DevID:0000001 Type:242 sType:1 nValue:0 sValue:19.00
2019-11-29 23:18:57.325 Debug: SQLH UpdateValueInt Temp茅rature Nest HwID:3 DevID:2 Type:82 sType:5 nValue:0 sValue:20.8;52;1
2019-11-29 23:19:17.192 (Tado) Thermostat (Home Chambre Setpoint)
2019-11-29 23:19:17.200 (Tado) Temp + Humidity (Home Chambre TempHum)
2019-11-29 23:19:17.203 (Tado) Lighting 2 (Home Chambre Heating On)`

And a screenshot of the hardware's registered devices:
Screenshot 2019-11-29 at 23 20 19

  1. I do not understand why the logs do not indicate the same IDX as my actual devices' IDX.
  2. I noticed that the two SetPoints that are mixed up share an almost identical ID (cf. screenshot).
  3. IDX 2 and 46 do exist as devices in my Domoticz setup. 2 is the temperature sensor of my "Nest Thermostat" hardware, 46 is a dummy percentage which reflects my Synology NAS RAM Usage.

I would like to help solving this issue but it is beyond my technical abilities.
However, I believe that this issue should be fixed as it prevents to use this hardware correctly.

Please feel free to ask me more information if needed, I will gladly share them.

Thanks for your support.

All 20 comments

I have the exact same thing with a new room I've added for Tado, and recognize your 1st and 3rd points.
I want to add two remarks to this:

  1. For me, the ID's are not as similar as for you
  2. For me, just like for you, it actually changes the living room setpoint. Or to be more precise, the first room
    image

Hi @GurbEHV,
Thank you for your feedback!

Based on your experience, I guess we can rule out the "almost identical ID" as root cause.
However, you are right to point out that the issue seems to be linked to the first room of the Tado configuration.

I hope someone can help us out regarding this issue as it prevents to manage Tado thermostats using Domoticz...

@gizmocuz sorry to bother but would you know anyone able to help on this?
I see a great potential with this plugin, it is sad this bug prevents to use it correctly.

@bxlouis , could you send me a message on the forum with this link included?
I could try to debug with your database and try to find the issue

@bxlouis , i meant a 'private message' ;) but i send you an email

@bxlouis,
Sorry about the delay !

I have tested this on the latest beta version, and i see no problems.
I did notice you have to adjust the temperature by 1 degrees, not by 0.5 degrees
I also inspected the response, and it is really set
Could you test with the beta version ?

I run the beta branch (4.11670), and it's still happening for me at the moment.
I think it's something to do with id's; either in domoticz, or the ones used when calling the Tado server. I see in the files sometimes 'idx' and sometimes 'Idx', is that on purpose? Also I understand you get the room and device id from a combined string? Maybe something happens there?

This is how I can reproduce the issue:

  1. Start with the following:
    image

  2. Then try to change the setpoint for the bottom one (which is zone 4):
    image

  3. But it actually changes the top one (which is zone 1):
    image

  4. In the log:
    2020-02-06 20:39:39.161 Tado: SetSetpoint() called with idx=146, temp=17.000000
    2020-02-06 20:39:39.161 Tado: CreateOverlay() called with idx=146, temp=17.000000, termination type=TADO_MODE
    2020-02-06 20:39:39.161 Status: User: Gerben initiated a SetPoint command

  5. Where I guess idx=146 refers to the hexadecimal 0x92? This would match up with the ID of 'Werkkamer Temp Setpoint':
    image

@bxlouis,
Sorry about the delay !

I have tested this on the latest beta version, and i see no problems.
I did notice you have to adjust the temperature by 1 degrees, not by 0.5 degrees
I also inspected the response, and it is really set
Could you test with the beta version ?

Hi @gizmocuz!
My turn to apologise for the delay.
I tested with the new release 2020.1 and unfortunately it does not solve the issue. I get exactly the same behaviour, which seems to be the same as the one described by @GurbEHV.
How my I help finding a fix?

Hello,

I took some time to read the plugin code.
Even though I am not able to actually fix the issue, I think I guess where it comes from.

If you take a look at the domoticz/hardware/Tado.cpp, line 144, you see that this is where the id of the thermostat to be updated is set:
std::string _sUrl = m_TadoEnvironment["tgaRestApiV2Endpoint"] + "/homes/" + m_TadoHomes[HomeIdx].Id + "/zones/" + m_TadoHomes[HomeIdx].Zones[ZoneIdx].Id + "/overlay";

I am quite certain that the issue lies with the "m_TadoHomes[HomeIdx].Zones[ZoneIdx].Id" variable, which defines which thermostat is going to be updated.

Also, I noticed that there is a gap in the ids in my Tado setup.
My thermostats bear the following ids:
1: Bedroom
2: Child Bedroom
3: Living room
5: Kitchen

And the issue is precisely that the "Kitchen" thermostat (id=5) does not work and updates the "Bedroom" thermostat (id=1).
I guess that there is somewhere an issue because of the missing id=4 which makes the plugin send 1 instead of 5.

I am quite certain that someone who understand the plugin code correctly would be able to fix the issue quite easily.

Any hope?

Hi,

The bug report is correct. hardware/Tado.cpp supports no more than 3 zones per home at the moment.
This due to the way homes, zones and devices are encoded in the DeviceID field of each device by Tado.cpp .

Essentially the code tries to squeeze its encoding into a 0xFF space. It doesn't work for more than 3 zones.

Tado.cpp line 98
int HomeIdx = node_id / 1000; int ZoneIdx = (node_id % 1000) / 100; int ServiceIdx = (node_id % 1000) % 100;
Tado.cpp line 305
SendSetPointSensor((unsigned char)ZoneIndex * 100 + 2, _fSetpointC, home.Name + " " + zone.Name + " Setpoint");

Tado.cpp line 327
UpdateSwitch((unsigned char)ZoneIndex * 100 + 4, _bManualControl, home.Name + " " + zone.Name + " Manual Setpoint Override");

the home map index gets multiplied by 1000
the zone map index get multiplied by 100

Example:
Home index 0 zone index 0 device type 5 (Heating Enabled Switch) = 5 = 0x5
Home index 0 zone index 1 device type 5 = 105 = 0x69
Home index 0 zone index 2 device type 5 = 205 = 0xCD
Home index 0 zone index 3 device type 5 = 305 = 0x131 no longer works!
Home index 0 zone index 4 device type 5 = 405 = 0x195 no longer works!
This is encoded as deviceID 0x31 and 0x95. (check your devices list). Subsequent calls to the Tado API fail because it cannot decode 0x31 or 0x95 to the correct zone in the Tado API.

Hello @LarsenDX
Thank you very much for taking the time to explain where the issue lies.
Would you have any time to submit a bug fix to this? Or does it require a long refactoring work?

The default build in function to Send a setpoint is

void CDomoticzHardwareBase::SendSetPointSensor(const uint8_t NodeID, const uint8_t ChildID, const unsigned char SensorID, const float Temp, const std::string& defaultname)

There are 3 id's you could provide, would that work ?

So do not use your own function, but use the internal one

@gizmocuz Yeah, I think using id1, id2, id3, id4 is the way to go for SetPoints and Switches. In the meantime I have pushed a quick fix to my fork that bumps support up to 10 zones in the current state of hardware/Tado.cpp .

@gizmocuz To your point about void CDomoticzHardwareBase::SendSetPointSensor(const uint8_t NodeID, const uint8_t ChildID, const unsigned char SensorID, const float Temp, const std::string& defaultname)

I've fixed Tado.cpp to make use of more id fields in the LIGHTING2 and _tThermostat objects.
This fixes the issue where Tado.cpp only supports 1 home and 3 zones (rooms) at most.
Moreover, it fixes the symptom reported here of Setpoint mix-ups. I therefore would like to withdraw pull request #4324. and propose e8d61ab in its stead.

@LarsenDX , that's fine of course! If users get better functionality this is always a plus

I updated and so far so good, thanks @LarsenDX!
I saw your remark in #4334, so I knew to delete the old switches. To be clear for others: for each zone the 'Setpoint', 'Manual Setpoint Override', 'Heating Enabled' and 'Heating On' devices will be recreated with new id's, so the old ones need to be removed.

Sorry to ask here but I鈥檇 like to test this without having to update Domoticz to a beta version. Is there any way to update the plugin manually?

@bxlouis , If you stop Domoticz, copy the complete folder to 'domoticz-bck', then (assuming you are on a raspberry pi or ubuntu) issue from the install folder
./updatebeta

then you can test the beta, after, stop domoticz, 'delete' the whole folder, then rename your backup folder to back to 'domoticz'

It works like a charm after updating to the latest beta.
Thanks @LarsenDX for your great work!

@gizmocuz I believe my issue can be marked as resolved unless you think otherwise.

Great, thank you for the feedback. Closing the issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

FireWizard52 picture FireWizard52  路  11Comments

TheReptile picture TheReptile  路  16Comments

Lyr3x picture Lyr3x  路  22Comments

RemCom picture RemCom  路  9Comments

JurikRistjouw picture JurikRistjouw  路  7Comments