When node-red starts up while the Miio Roborock is not connected to the network yet, it fails to connect to it even if it comes online after some time. This is what can be read from the node-red logs:
31 Dec 16:17:24 - [warn] [miio-roborock-server:Miio server] Miio Roborock Error: send ENETUNREACH 192.168.1.64:54321
(node:342) UnhandledPromiseRejectionWarning: Error: send ENETUNREACH 192.168.1.64:54321
at SendWrap.afterSend [as oncomplete] (dgram.js:467:11)
(node:342) 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(). (rejection id: 1)
(node:342) [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.
The solution
Catching all the uncaught promises
Retrying retrieving connection by using a function retryOperation, which retries a promise if it fails
The problem
When
node-red
starts up while the Miio Roborock is not connected to the network yet, it fails to connect to it even if it comes online after some time. This is what can be read from thenode-red
logs:The solution
retryOperation
, which retries a promise if it fails