I think there are a few things that need to happen in patient connection sub-mode (e.g. get UF volume, get initial blood pressure reading, ...) before user should be allowed to start treatment. Need to check which state in patient connection sub-mode we're in too - should the last state where we've done everything and waiting for user to start.
We are in agreement that each test should be self contained. To ensure each test is self-contained, each test needs to have a separate instance of HDSimulator. The design of dialin is not the focus of this review...
What is utils.dict_update? Please use the SquishQt recommended syntax and functions as has been explained and described in their examples. I don't see any reason why we need to have a new function. Also, I would rather let SquishQt test and check the existence of the properties (in this case ".text") instead of another function adding a property to the dictionary without making sure that the object actually has the property and not checking the object tree.
** Please remove all the usage in all other places ** **
Still don't feel comfortable with this solution and haven't been convinced that it should be the way to get around the SquishQt issue of finding the object within the given timeout. On the other hand, don't have a better idea to stop the test from failing randomly. So would be better to keep it for now.
Consider having a switch statement here for each reject reason code. Maybe we're only handling the invalid parameter reason for now, but we may change our minds later. You can group the rest of the reasons+default with just a comment that our state machines will detect and handle failure of DG to advance for now. This will make it clear that we didn't forget about the other cases.
Before, the HD sends target temperature using another message. So now we add the target temperature to this command, so DG can handle the full command.
The current design is for each mode to set actuators on entry to a new mode/sub-mode (e.g. this function) per that mode's initial state. Then, while in that mode/sub-mode, the mode's state machine will change actuators as required when moving from one state to another.
Yes, if drain pump is pumping too fast, the combined flow from drain pump and from RO pump is too much for the length of tubing after the two merge and go to drain. Starts to cavitate and causes a lot of turbulence.
The available log levels are listed in the docstring of the HD constructor. It simplifies debugging someone's script to not have to import dialin logging levels when we need to debug their code. Since the HD/DG logging is not intended to be used by dialin script writers, and is a dialin developer-only capability, adding enum imports to user scripts when we want to debug their code would be an unnecessary hindrance.