Closed mithrandir1 closed 2 years ago
Thanks for the pull request. Can you source where you determined it has a 2 minute timeout? The specifications for WMP don't show this - and I suspect there is something else we can fix rather than just adding a poll_status every minute.
Sure, first I determined the timeout in my logfile, second I read about it in the wmp specification: https://cdn.hms-networks.com/docs/librariesprovider11/manuals-design-guides/wmp-protocol-specifications.pdf?sfvrsn=339b5cd7_14
In the description you can read: Intesis devices close the TCP communication if no communication is received during 2 minutes. To avoid unexpected TCP communication losses with the device, it is highly recommended to periodically ping the device or demand a value (e.g. ambient temperature) with an appropriate period of time (30s ≤ t ≤ 1min).
Thanks! Was reading that earlier but missed that paragraph. Nice one, I'll review tomorrow
@mithrandir1 I think I addressed this previously (in #16) by having the integration send ping's regularly so I'll close this, but if I missed something let me know and I'll take another look. Thanks for the PR either way.
The intesisbox has a 2 minute idle timeout, so I changed auto_update, which is triggered by ha every minute (scan_interval) to poll for the device status. I moved the code from auto_update to auto_update_data which is triggered by the controller, when new data is received. So every minute ha triggers the auto_update, which runs a poll_status. The box answers with all current values, they are received by the controller (data_received) and the controller calls the auto_update_data callback, which then copies the state from the controller to home-assistant. Before the changes, home-assistant lost the connection every 2 minutes, and re established it immediately. Now the connection isn't lost, and the current status is reported.