mangoose002 / meross2domoticz Goto Github PK
View Code? Open in Web Editor NEWNodeJS bridge between Meross IOT and Domoticz
License: GNU Lesser General Public License v3.0
NodeJS bridge between Meross IOT and Domoticz
License: GNU Lesser General Public License v3.0
In the case of the script is started without any dummy hardware in Domoticz, this ons crash with
TypeError: Cannot read property 'filter' of undefined
at Request._callback (/mnt/mmcblk0p3/plugins/Meross2Domoticz/meross2domoticz.js:73:40)
at Request.self.callback (/mnt/mmcblk0p3/plugins/Meross2Domoticz/node_modules/request/request.js:185:22)
at emitTwo (events.js:126:13)
at Request.emit (events.js:214:7)
at Request.<anonymous> (/mnt/mmcblk0p3/plugins/Meross2Domoticz/node_modules/request/request.js:1154:10)
at emitOne (events.js:116:13)
at Request.emit (events.js:211:7)
at IncomingMessage.<anonymous> (/mnt/mmcblk0p3/plugins/Meross2Domoticz/node_modules/request/request.js:1076:12)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)
At line 73 there is a control doing too late :
var hardware = domohardware.result.filter( ob => { return ob.Type == 15; });
if(hardware && Array.isArray(hardware) && hardware.length > 0){
hardware = hardware.pop();
DummyHardwareId = hardware.idx;
LogToConsole(debug,"Dummy hardware found (" + DummyHardwareId + "). Autocreate enabled");
} else {
autocreate = false;
LogToConsole(debug,"No dummy hardware found. Autocreate disabled");
}
Fixed code :
if (domohardware.result == undefined)
{
autocreate = false;
LogToConsole(debug,"No dummy hardware found. Autocreate disabled");
return;
}
var hardware = domohardware.result.filter( ob => { return ob.Type == 15; });
if(hardware && Array.isArray(hardware) && hardware.length > 0){
hardware = hardware.pop();
DummyHardwareId = hardware.idx;
LogToConsole(debug,"Dummy hardware found (" + DummyHardwareId + "). Autocreate enabled");
} else {
autocreate = false;
LogToConsole(debug,"No dummy hardware found. Autocreate disabled");
}
It acts the same as a MSS425
I can add it as a recognised device
if(device.dev.deviceType == "mss310" || device.dev.deviceType == "mss210" || device.dev.deviceType == "mss420f" || device.dev.deviceType.indexOf("mss425") != -1){
but I am unable to to add it to the section that creates the devices
if(device.dev.deviceType.indexOf("mss425") != -1){
Hello !
I have a problem...
Can you help me ?
My logs says :
SyntaxError: Unexpected token < in JSON at position 0
at JSON.parse (<anonymous>)
at Request._callback (/home/pi/meross2domoticz.js:72:29)
at Request.self.callback (/home/pi/node_modules/request/request.js:185:22)
at Request.emit (events.js:315:20)
at Request.<anonymous> (/home/pi/node_modules/request/request.js:1154:10)
at Request.emit (events.js:315:20)
at IncomingMessage.<anonymous> (/home/pi/node_modules/request/request.js:1076:12)
at Object.onceWrapper (events.js:421:28)
at IncomingMessage.emit (events.js:327:22)
at endReadableNT (_stream_readable.js:1224:12)
Thanks !
Stop working since 3 days 😭
Something change in Merros server ?
Any ideas?
Bonjour.
Tout d'abord merci pour ton script.
J'utilise Domoticz 4.11214 sur un raspberry.
J'ai des prises Meross mss310. J'essaie d'en ajouter une sous Domoticz pour tester.
J'ai suivi les étapes du guide d'installation : https://github.com/mangoose002/Meross2Domoticz/wiki/Installation
Mais en activant sous Domoticz la détection automatique avec le bouton "Autoriser pendant 5 minutes", je n'obtiens rien, pas de dispositifs ajoutés.
J'ai beau jouer avec l'application Meross (allumer ou éteindre la prise), rien ne se passe dans domoticz.
Y'a-t-il un log que je peux consulter ? J'ai regardé dans /tmp/domoticz.log mais il n'y a rien.
Merci
Fabien
Installed on a raspbian buster domoticz last update
It has created my switches but it won’t work
Hi there,
It starts, I can see my devices listed when running pm2 logs, but here is what happens next :
0|meross2domoticz | TypeError: Cannot read properties of undefined (reading 'filter')
0|meross2domoticz | at Object.callback (/root/Meross2Domoticz/meross2domoticz.js:552:50)
0|meross2domoticz | at MerossCloudDevice.handleMessage (/root/Meross2Domoticz/node_modules/meross-cloud/index.js:472:62)
0|meross2domoticz | at MqttClient. (/root/Meross2Domoticz/node_modules/meross-cloud/index.js:358:46)
0|meross2domoticz | at MqttClient.emit (node:events:513:28)
0|meross2domoticz | at MqttClient._handlePublish (/root/Meross2Domoticz/node_modules/meross-cloud/node_modules/mqtt/lib/client.js:1547:12)
0|meross2domoticz | at MqttClient._handlePacket (/root/Meross2Domoticz/node_modules/meross-cloud/node_modules/mqtt/lib/client.js:535:12)
0|meross2domoticz | at work (/root/Meross2Domoticz/node_modules/meross-cloud/node_modules/mqtt/lib/client.js:438:12)
0|meross2domoticz | at writable._write (/root/Meross2Domoticz/node_modules/meross-cloud/node_modules/mqtt/lib/client.js:452:5)
0|meross2domoticz | at doWrite (/root/Meross2Domoticz/node_modules/meross-cloud/node_modules/readable-stream/lib/_stream_writable.js:409:139)
0|meross2domoticz | at writeOrBuffer (/root/Meross2Domoticz/node_modules/meross-cloud/node_modules/readable-stream/lib/_stream_writable.js:398:5)
PM2 | App [meross2domoticz:0] exited with code [1] via signal [SIGINT]
Just to be 100% precise here:
I an see the connection to mqtt is happening, then the script crashes for the above reason, resulting in this :
1663316978: New connection from ::1:48332 on port 1883.
1663316978: New client connected from ::1:48332 as mqttjs_0ed6f13f (p2, c1, k60, u'user').
1663316988: Client mqttjs_0ed6f13f closed its connection.
1663316991: New connection from ::1:48334 on port 1883.
1663316991: New client connected from ::1:48334 as mqttjs_58cf08cb (p2, c1, k60, u'user').
1663316998: Client mqttjs_58cf08cb closed its connection.
it simply keeps connecting and disconnecting due to the fact the script chrashes and restarts in loop.
Hello, for my MEROSS MSS310, I can't send or receive the command on/off,
so I find in command:
"device.on('data', (namespace, payload) "
the namespace returned is Appliance.Control.Toggle and not Appliance.Control.ToggleX,
so the payload like "payload":{"toggle":{"onoff":0,"lmTime":1557843686}}}
so I modify :
channel = payload.togglex.channel;
nvalue = payload.togglex.onoff;
to
channel = 0;
nvalue = payload.toggle.onoff;
and for command :
"client.on('connect', function () {"
I change
dev.controlToggleX(channel,obj.nvalue);
to
dev.controlToggle(obj.nvalue);
Now, all is correct in my case.
Thank you for seeing work
Hello
Running : npm install meross2domoticz
config.json file isn't created, it needs to be created by our own
In the wiki instruction please append at: "It should connect to the Meross cloud and to the MQTT broker. It will create all the devices in Domoticz (if you authorized device creation)." that you have to create before at least a "Dammy hardware" to have device created.
MSS310
Firmware - 2.1.9
Hardware - 2.0.0
After a toggle or reading the power consumption
18121193618636221a1034298f13c72a connected
1806290568048239081534298f15aee6 connected
Sending state to Meross
18121193618636221a1034298f13c72a data: "Appliance.Control.ToggleX"
/home/pi/node_modules/meross-cloud/index.js:252
this.emit('close', error.toString());
^
TypeError: Cannot read property 'toString' of undefined
at MqttClient.client.on (/home/pi/node_modules/meross-cloud/index.js:252:38)
at MqttClient.emit (events.js:194:15)
at TLSSocket.f (/home/pi/node_modules/once/once.js:25:25)
at TLSSocket.onfinish (/home/pi/node_modules/end-of-stream/index.js:30:27)
at TLSSocket.emit (events.js:189:13)
at finishMaybe (_stream_writable.js:641:14)
at stream._final (_stream_writable.js:619:5)
at TLSSocket.Socket._final (net.js:353:12)
at callFinal (_stream_writable.js:612:10)
at process._tickCallback (internal/process/next_tick.js:63:19)
Hi,
This plugin does work very well (here on a Windows installation of Domoticz).
I have two meross devices currently unsupported : a wall switch (mss550l) and a bedside lamp (msl420).
Your script is able to see them and if I edit the RegExp those are working as it should for turning them on and off (I added them to the 1 channel switch devices)
However, the Meross Cloud library is also supporting light devices, so it would be great to handle the light correctly. The only light device I have is this bedlamp and it support color and brightness (it has supported white temp but meross changed that recently)
I would be happy to apply changes and test the device for you (I could do it myself but you may do it way faster than me, as I'm not familiar at all with MQTT)
Hi, thanks for you're work.
i have a little problem so I don't find way to solve.
I launch the bridge with pm2 , but sometime program stop , but not crash so pm2 cannot restart it.
look like timeout problem, I show you the log .
0|meross2d | TypeError: Cannot read property 'ability' of undefined
0|meross2d | at Object.dev.getSystemAbilities [as callback] (/home/pi/Meross2Domoticz/meross2domoticz.js:247:28)
0|meross2d | at Timeout.waitingMessageIds.(anonymous function).timeout.setTimeout [as _onTimeout] (/home/pi/Meross2Domoticz/node_modules/meross-cloud/index.js:333:55)
0|meross2d | at ontimeout (timers.js:475:11)
0|meross2d | at tryOnTimeout (timers.js:310:5)
0|meross2d | at Timer.listOnTimeout (timers.js:270:5)
Thanks for you're time , I hope you can help me.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.