home-climate-control/dz

Support "optimistic" switches

Closed this issue · 0 comments

Existing Behavior

Hardware drivers verify results of setState() with getState(). Benefits: guaranteed behavior. Disadvantages: complicated control logic, chances to get stuck.

Problems with Existing Behavior

One particularly vile problem is with ESPHome switch MQTT component which reports the hardware state if it changes but doesn't report it if it stays the same, resulting in an apparent deadlock.

Behavior Adjustment

It is possible to treat hardware as 100% reliable and assume that it always accepts and executes commands, as long as reliability is enforced by other means.

Mandatory precautions

  • Optimistic behavior for performance sake must never be a default option
  • Whenever optimistic behavior is used, a clearly visible log warning must be issued.

Related Issues

#47, #271, #290