geoffdavis / esphome-mitsubishiheatpump

ESPHome Climate Component for Mitsubishi Heatpumps using direct serial connection
BSD 2-Clause "Simplified" License
588 stars 158 forks source link

Add safeguards for the set_remote_temperature function #97

Closed donutsoft closed 1 year ago

donutsoft commented 1 year ago

I've added some safety guards for the set_remote_temperature function which will ensure that the Mitsubishi will revert back to internal temperature in the event that the remote sensor goes down or cannot be communicated with.

I've separated this out into 3 different timeouts

  1. While the machine is heating or cooling. Timeouts should be shorter while the machine is in this state as we expect the temperature to shift when heat is being pumped, and also the cost of failure is higher in this case.
  2. While the machine is idle. Timeout can be longer as some zigbee based temperature sensors will only send updates once a temperature change happens, and if they do happen to go offline then the cost is minimal to the user (unlike the heating/cooling case)
  3. Ping timeouts: If HomeAssistant/NodeRed/WiFi goes down. This should be a rapid timeout as there is no chance that the heatpump can receive remote sensor updates if this happens.

This is my first time doing any ESPHome development, so any feedback on how to do this better would be appreciated. And thank you for all your hard work in running this project!