howartp wrote:The variable state should then update automatically whenever the virtual device changes state,
Incorrect. It's the opposite - the state of the device mirrors the variable. So, he's done it correctly. A virtual device is not meant to maintain its own state but rather as a mechanism that can be used to create a pseudo device that connects to something else, that something else being what actually has the state maintenance.