Install node v14+, then run npm ci --prod
to setup dependencies.
For command and its flags, run node meross help
for built-in usage & help.
Currently implemented commands:
login
generate-config
Run node meross <command> --help
for command help.
Run generate-config
command to generate a random mobile config (uuid):
node meross generate-config
Then run the script to fetch user info:
# Login to US region (default)
node meross login "jixun.moe@your.email.com" "your-password"
# Login to EU region
node meross login --region EU "jixun.moe@your.email.eu" "your-password"
Your should see the following:
{
"apiStatus": 0,
"sysStatus": 0,
"data": {
"token": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"key": "ffffffffffffffffffffffffffffffff",
"userid": "123456789",
"email": "jixun.moe@your.email.com",
"domain": "https://us-iot.meross.com",
"mqttDomain": "mqtt-us.meross.com"
},
"info": "Success",
"timeStamp": 123456789
}
... along with a message login ok! save to user.json...
.
Old login script, us region only:
node src/bin/do-login.js "jixun.moe@your.email.com" "your-password"
In the case of region error:
{
"apiStatus": 1030,
"sysStatus": 0,
"data": {
"domain": "https://us-iot.meross.com",
"mqttDomain": "mqtt-us.meross.com"
},
"info": "redirect app to login other than this region",
"timeStamp": 1623977935
}
Update RemoteAPI::remoteBase
to the new data.domain
field value.
The us-iot.meross.com
domain is enabled by default.
key
is required to sign your request to Meross' IOT device, in some cases.
See Robdel12/homebridge-meross-plug#1 for more technical information.
private static BaseBean setupSign(String strFrom, String strMethod, String strNamespace) { // setup some signature stuff
BaseBean bean = new BaseBean();
Header header = new Header();
long time = System.currentTimeMillis() / 1000; // unix seconds
String messageId = PackageFactory.generateMessageId(); // random MD5 string
header.setMessageId(messageId);
header.setSign(PackageFactory.calculateMD5AllParts(messageId, User.getInstance().key, String.valueOf(time)).toLowerCase());
header.setFrom(strFrom);
header.setTimestamp(Long.valueOf(time));
header.setMethod(strMethod);
header.setNamespace(strNamespace);
header.setPayloadVersion(Integer.valueOf(1));
bean.setHeader(header);
return bean;
}
Where:
const calculateMD5AllParts = (a, b, c) => md5(a + b + c).toString('hex');
const generateMessageId = () => md5('anything unique').toString('hex');
For an example of the header, see: Robdel12/homebridge-meross-plug/src/index.js#L146
- Publish this npm package somewhere (github/npmjs)
- Publish to
ghcr.io
as a docker container - Instruction on how to contribute / debug / capture
meross_v2.28.1.apk
The 3-Clause BSD License