bitfocus / companion-module-lgtv-display

MIT License
6 stars 2 forks source link

Graceful error handling when TV IP is not reachable #4

Open llamafilm opened 2 years ago

llamafilm commented 2 years ago

If Companion launches while the TV is powered off (or not reachable by IP), the module shows an error status until you disable and re-enable it. If running in yarn dev it crashes with the following error message. Running in the normal way this error message is hidden, but it sounds like this will break in a future version of Node. I'm using 14.19.3.

(node:95783) UnhandledPromiseRejectionWarning: Error: connect ETIMEDOUT 192.168.10.232:9761
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)
(Use `Electron --trace-warnings ...` to show where the warning was created)
(node:95783) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:95783) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Jibun-no-Kage commented 1 month ago

Nice feature would be 'feed back' when the TV is off network, when TV is on network but not fully ready, and then feed back when TV is fully ready. This could be done via Wes's module using the getIpControl and getCurrentApp methods.

1) No ping, i.e. getIpControl() false, off network 2) Ping and/or getIpControl() true, but no current app, i.e. getCurrentApp() undefined, on network but WebOS still not ready 3) Ping, getIpControl() true, getCurrentApp() returns string, WebOS is fully up and ready.

As along feed back for volume level, mute state, add screen state, power state, etc., these are all part of the Wes='s lgtv-ip-control module he has enhanced over time.