mangoose002 / Meross2Domoticz

NodeJS bridge between Meross IOT and Domoticz
GNU Lesser General Public License v3.0
5 stars 2 forks source link

MSS310 - Do not receive or send ON-OFF #3

Closed KimNowakowski closed 5 years ago

KimNowakowski commented 5 years ago

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

mangoose002 commented 5 years ago

Could you check with the latest version. This should work for any confirguration and abilities now.

KimNowakowski commented 5 years ago

I'm test the new version so I need comment a few lines in device.on('data', (namespace, payload) => { _//if(Array.isArray(payload.togglex)){ // channel = payload.togglex[0].channel; // nvalue = payload.togglex[0].onoff; //} else { // if(payload.togglex == undefined){ // return; // } // channel = payload.togglex.channel // nvalue = payload.togglex.onoff; //} and now all is correct for me (bi-directionnal communication).

Just another comment, when I test on a fresh install of domoticz, with no device created, the script not run when autocreate because when var dev = domodevices.result.filter( ob => { return ( ob.Description === device.dev.uuid && ob.Type === "General" && ob.SubType === "kWh") } ); domodevices.result is undefined.

Not a problem if a least one device was created before launch your script.

Very good job.

Best regards.

mangoose002 commented 5 years ago

As KimNowakowski wrote, I forgot to remove a old piece of code. It is removed in the latest version. I also test if there are devices returned by domoticz before filtering them. I think that everything should be fixed.