Closed hnakai0909 closed 2 years ago
Well the true error is actually that the device you specified at 10.10.10.155
doesn't have the Meross HTTP API or doesn't exist. It's unusual for a Meross device to use anything but 10.10.10.1
except when it's connected to your WiFi.
I mean 10.10.10.155
is just one of the example to manually cause network-related error, so this address does not have meaning.
What I wanted to say is, when network-related error happens, some of that that does not contains url
in error.request
, the TypeError cause, and we cannot get what the real error is.
Related PR #36 issued.
Sorry, there are no need to add sudo
, so I fixed logs.
Problem:
./meross
throwsTypeError [ERR_INVALID_ARG_TYPE]
and cannot see what the real error is, when./meross
with-v
option and situation that occuring some network error, such as reserving inappropriate IP address to--gateway
option.Log:
10.10.10.155
is not meaningful IP address example which not exist Meross device.My environment: Hardware : Raspberry Pi 1 (Yes, it's old)
Cause?: In https://github.com/bytespider/Meross/blob/7a9ea926d3479b6a90dff256c59547c57f7614aa/lib/api.js#L62 ,
logRequest()
fails if argumentrequest
does not containsurl
.My workaround: In https://github.com/bytespider/Meross/blob/7a9ea926d3479b6a90dff256c59547c57f7614aa/lib/api.js#L98 ,Fix
} else if (error.request) {
to} else if (error.request && error.request.url) {
Log with applying workaround: Shows error normally (without TypeError).