Since it was not clear to me from reading the threshold documentation for what upper/lower limits with/without hysteresis exactly a state change would occur, here is the actual behavioral matrix (excluding negative hysteresis, not sure what that should be or if it is really even supported), which I tested with HA 2024.7.2. If this is agreed upon I think I would create a github pull request to add the matrix to the above linked documentation for users convenience.
Matrix tested with value of hysteresis >= 0
Sensor value rising
set | turns on when | turns off when |
---|---|---|
only upper | sensor > (upper + hyst) | never |
only lower | never | sensor > (lower + hyst) |
upper & lower | sensor > (lower + hyst) | sensor > (upper + hyst) |
Sensor value falling
set | turns on when | turns off when |
---|---|---|
only upper | never | sensor < (upper - hyst) |
only lower | sensor < (lower - hyst) | never |
upper & lower | sensor < (upper - hyst) | sensor < (lower - hyst) |