lukasroegner / homebridge-tado-smart-thermostat

Plugin for using Tado devices in homebridge.
MIT License
13 stars 4 forks source link

Open Window detection issue #10

Closed bxlouis closed 4 years ago

bxlouis commented 4 years ago

After performing some tests with open window detection I believe that either there is an issue or the status update frequency is too low.

I let multiple windows open for more than 10 minutes each and never got the contact sensor to update in the Home app. The open windows were all detected in the Tado App.

lukasroegner commented 4 years ago

@bxlouis The update interval of the window state is the same as the interval of state changes of the thermostat (current temperature, target temperature). This interval defaults to 60 seconds and can be changed in the configuration with the stateUpdateInterval property.

I did a short test and it works fine for me. I published a new version with additional debug info when the state is updated, so that you can start Homebridge with -D parameter and get the detailed state data from the thermostats. This should make it easier to find the issue. The plugin uses the property openWindow:

bxlouis commented 4 years ago

Hi @lukasroegner, I think I might have found why it does not work with my setup. As I explained in the other ticket about Home/Away mode, we use different configurations as I am not paying for the Tado "Auto Assist" feature.

I was able to retrieve the log from both Homebridge and the Tado API at the same time when it detected an open window. Here are the results:

Homebridge [5/14/2020, 4:53:16 PM] [TadoPlatform] 2 - new state: {"tadoMode":"HOME","geolocationOverride":false,"geolocationOverrideDisableTime":null,"preparation":null,"setting":{"type":"HEATING","power":"ON","temperature":{"celsius":20,"fahrenheit":68}},"overlayType":null,"overlay":null,"openWindow":null,"nextScheduleChange":{"start":"2020-05-14T19:30:00Z","setting":{"type":"HEATING","power":"ON","temperature":{"celsius":19,"fahrenheit":66.2}}},"nextTimeBlock":{"start":"2020-05-14T19:30:00.000Z"},"link":{"state":"ONLINE"},"activityDataPoints":{"heatingPower":{"type":"PERCENTAGE","percentage":55,"timestamp":"2020-05-14T14:50:45.322Z"}},"sensorDataPoints":{"insideTemperature":{"celsius":19.69,"fahrenheit":67.44,"timestamp":"2020-05-14T14:46:44.424Z","type":"TEMPERATURE","precision":{"celsius":1,"fahrenheit":1}},"humidity":{"type":"PERCENTAGE","percentage":41.2,"timestamp":"2020-05-14T14:46:44.424Z"}}}

Tado { "tadoMode": "HOME", "geolocationOverride": false, "geolocationOverrideDisableTime": null, "preparation": null, "setting": { "type": "HEATING", "power": "ON", "temperature": { "celsius": 20.00, "fahrenheit": 68.00 } }, "overlayType": null, "overlay": null, "openWindow": null, "openWindowDetected": true, "nextScheduleChange": { "start": "2020-05-14T19:30:00Z", "setting": { "type": "HEATING", "power": "ON", "temperature": { "celsius": 19.00, "fahrenheit": 66.20 } } }, "nextTimeBlock": { "start": "2020-05-14T19:30:00.000Z" }, "link": { "state": "ONLINE" }, "activityDataPoints": { "heatingPower": { "type": "PERCENTAGE", "percentage": 0.00, "timestamp": "2020-05-14T13:58:41.233Z" } }, "sensorDataPoints": { "insideTemperature": { "celsius": 21.39, "fahrenheit": 70.50, "timestamp": "2020-05-14T14:09:45.251Z", "type": "TEMPERATURE", "precision": { "celsius": 1.0, "fahrenheit": 1.0 } }, "humidity": { "type": "PERCENTAGE", "percentage": 44.70, "timestamp": "2020-05-14T14:09:45.251Z" } } }

As you can see, in the Tado response, the property "openWindow" is indeed 'null' but another property "openWindowDetected" appears when the window is opened. Note that this property is not sent back when the window is closed, as you can see here for another room:

{ "tadoMode": "HOME", "geolocationOverride": false, "geolocationOverrideDisableTime": null, "preparation": null, "setting": { "type": "HEATING", "power": "ON", "temperature": { "celsius": 18.00, "fahrenheit": 64.40 } }, "overlayType": null, "overlay": null, "openWindow": null, "nextScheduleChange": null, "nextTimeBlock": null, "link": { "state": "ONLINE" }, "activityDataPoints": { "heatingPower": { "type": "PERCENTAGE", "percentage": 0.00, "timestamp": "2020-05-14T14:04:27.797Z" } }, "sensorDataPoints": { "insideTemperature": { "celsius": 19.01, "fahrenheit": 66.22, "timestamp": "2020-05-14T14:12:30.703Z", "type": "TEMPERATURE", "precision": { "celsius": 1.0, "fahrenheit": 1.0 } }, "humidity": { "type": "PERCENTAGE", "percentage": 40.70, "timestamp": "2020-05-14T14:12:30.703Z" } } }

lukasroegner commented 4 years ago

How did you get the Tado state, i.e. which URL did you use?

bxlouis commented 4 years ago

https://my.tado.com/api/v2/homes/{{HOMEID}}/zones/{{ROOMID}}/state

lukasroegner commented 4 years ago

This is exactly the same URL that the node-tado-client package uses when getting the zone state:

getZoneState(home_id, zone_id) {
    return this.apiCall(`/api/v2/homes/${home_id}/zones/${zone_id}/state`);
}

Can you please double check that the Homebridge logs don't include the openWindowDetected property? They should include the property, as the same API endpoint is used.

bxlouis commented 4 years ago

@lukasroegner indeed, my mistake, the property is correctly sent when the window is opened. However, it is not taken into account by the plugin.

And it is important to note that the Tado API itself does not send back the openWindowDetected property at all when the window is closed.

[5/15/2020, 5:14:52 PM] [TadoPlatform] 1 - Updated state. [5/15/2020, 5:14:52 PM] [TadoPlatform] 1 - new state: {"tadoMode":"HOME","geolocationOverride":false,"geolocationOverrideDisableTime":null,"preparation":null,"setting":{"type":"HEATING","power":"ON","temperature":{"celsius":18,"fahrenheit":64.4}},"overlayType":null,"overlay":null,"openWindow":null,"openWindowDetected":true,"nextScheduleChange":null,"nextTimeBlock":null,"link":{"state":"ONLINE"},"activityDataPoints":{"heatingPower":{"type":"PERCENTAGE","percentage":0,"timestamp":"2020-05-15T15:08:11.943Z"}},"sensorDataPoints":{"insideTemperature":{"celsius":21.04,"fahrenheit":69.87,"timestamp":"2020-05-15T15:05:32.036Z","type":"TEMPERATURE","precision":{"celsius":1,"fahrenheit":1}},"humidity":{"type":"PERCENTAGE","percentage":49.9,"timestamp":"2020-05-15T15:05:32.036Z"}}}

lukasroegner commented 4 years ago

However, it is not taken into account by the plugin.

Now it is, new version 0.4.3 on NPM.