Open ff6347 opened 4 years ago
Mhhh … use it in what way? To keep track of the plugs state is something I put on the todo list for later. I don't really see a use-case at the moment. Normally if you make changes to the setup you would probably restart the server anyway.
I think this should be solid enough for now.
No. I mean the plug could return false and you wouldn't notice. Just normal error handling
What would you recommend in such a case? Throw an error in the UI?
Yes. Since no one will watch the shell.
But they should watch the exhibition. If something is not working they are going to complain anyway. ;)
But an error handler that tells you on screen "hey. exhibit foo could not start the power" is a nice feature. If this would be there the user knows that the plug didn't or did work.
IMO it helps troubleshooting the process.
From the docs I see that
plug.setPowerState()
returns aPromise <true>
would be good not only to assume the plug is on, but to use the response. ;) https://github.com/technologiestiftung/exhibition-remote-control/blob/c0ee643af4ede9e8695de5715ca4a124c8399ca9/index.js#L43