Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Solve toggle bypass issue for COMNAV (#27)
For COMNAV vendor, both bypass and unbypass services, act as toggles. Furthermore, when 2 or more zones are bypassed, if we call the bypass service in HA for one of the already bypassed zones, it toggles the last zone we have in the payload. This is happening cause, no matter what the result of the check is, it will send the payload, as the response is out of the if statements. Currently, we start the payload, inside we run all the if statements for each each Vendor, and then we send the payload response. In the case of XGEN8, inside the if statement, we call the payload.update each time, and therefore it is working correctly. However, in COMNAV, since the payload is the same all the time cause it acts as a toggle, if the can_bypass is equal with the state, then the payload of the zone selected, will be send. If it is not, it will skip the payload and send the last payload response. The propose changes, put the payload response inside the if statements for each vendor. Thus, for COMNAV, if the zone is already bypassed, it will NOT send the response at all. The only check that needs to be performed, is for the other vendor, XGEN8, for which i do not have any, to validate the change.
- Loading branch information