[Bug] Chuangmi Plug HMI206 Power Plug Switch not working
Closed this issue · 1 comments
As there is no official API and Xiaomi does not support third-party integration, being able to add a device to the Homey app depends on an existing integration, online documentation or donating the device to the developer. If neither of these can be fulfilled then integration is not possible.
Supply the device details
- Name: (Mi Smart Plug WiFi)
- Model ID: chuangmi.plug.hmi206
- MIoT spec: https://home.miot-spec.com/spec/chuangmi.plug.hmi206
Current support
Switching does not turn on/off device. While in the Xiaomi app it does work. Also in the Home assistant app it does work.
Additional information
I wasn't able to run this plugin on Homey because I get errors when I try to for some reason. If you know how to fix this I might be able to better debug the device and possibly add a fix.
Node version: 20.11.1
NPM version: 10.4.0
Full error:
─────────────── Logging stdout & stderr ───────────────
Unable to initialize app TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
at new NodeError (node:internal/errors:371:5)
at validateString (node:internal/validators:120:11)
at Object.join (node:path:1172:7)
at userData (/node_modules/appdirectory/lib/appdirectory.js:21:29)
at AppDirectory._setTemplates (/node_modules/appdirectory/lib/appdirectory.js:134:34)
at new AppDirectory (/node_modules/appdirectory/lib/appdirectory.js:129:10)
at Object.<anonymous> (/node_modules/miio/lib/tokens.js:8:14)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32) {
code: 'ERR_INVALID_ARG_TYPE'
}
/opt/homey-client/system/manager/ManagerApps/AppProcess/node_modules/@athombv/homey-apps-sdk-v3/lib/Homey.js:1
"use strict";const path=require("path"),SimpleClass=require("./SimpleClass.js"),Manager=require("./Manager.js");class Homey extends SimpleClass{constructor(e,t,s,i,r){super(),this.dir=e,this.tmpdir=path.join(e,"tmp"),this.version=s,this.platform=i,this.platformVersion=r,this.env={},this.manifest=t,this.app={},this.__readyPromise=new Promise(e=>{this.__readyResolve=e}),this._timers=new Set,this._destroyed=!1,this.apps={},this.arp={},this.audio={},this.ble={},this.cloud={},this.clock={},this.drivers={},this.discovery={},this.flow={},this.geolocation={},this.i18n={},this.images={},this.insights={},this.ledring={},this.nfc={},this.notifications={},this.rf={},this.settings={},this.speechInput={},this.speechOutput={},this.zigbee={},this.zwave={},this.api={}}ready(){return this.__readyPromise}markReady(){this.__readyResolve()}hasPermission(e){return!1!==Array.isArray(this.manifest.permissions)&&this.manifest.permissions.includes(e)}__(e,t){}setTimeout(e,t,...s){if(this._destroyed)return null;const i=setTimeout(()=>{this._timers.delete(i),e(...s)},t);return this._timers.add(i),i}clearTimeout(e){clearTimeout(e),this._timers.delete(e)}setInterval(e,t,...s){if(this._destroyed)return null;const i=setInterval(e,t,...s);return this._timers.add(i),i}clearInterval(e){clearInterval(e),this._timers.delete(e)}destroy(){this.__debug("Homey Destroyed"),this.emit("unload"),this._destroyed=!0;for(const e of this._timers.values())clearTimeout(e);const e={emit:async e=>{throw this.__debug(`Emit after destroy ${e}`),new Error(`Cannot send "${e}" because the app instance has been destroyed.\n`+"This may indicate that your app is not cleaning up all resources in `onUninit()`.")}},t=this.app,s=this.drivers;for(const t of Object.keys(this)){const s=this[t];s instanceof Manager&&(this[t]=void 0,s.homey=void 0,s.__client=e,s.removeAllListeners(),Object.defineProperty(this,t,{get(){throw new Error(`Cannot access \`this.homey.${t}\` because the app instance has been destroyed.\n`+"This may indicate that your app is not cleaning up all resources in `onUninit()`.")}}))}this.app=void 0,Object.defineProperty(this,"app",{get(){throw new Error("Cannot access `this.homey.app` because the app instance has been destroyed.\nThis may indicate that your app is not cleaning up all resources in `onUninit()`.")}}),this.removeAllListeners(),Promise.resolve().then(()=>t.onUninit()).catch(this.error);for(const e of Object.values(s.getDrivers())){Promise.resolve().then(()=>e.onUninit()).catch(this.error);for(const t of e.getDevices())Promise.resolve().then(()=>t.onUninit()).catch(this.error)}}}module.exports=Homey;
Error: Cannot access `this.homey.app` because the app instance has been destroyed.
This may indicate that your app is not cleaning up all resources in `onUninit()`.
at Homey.get [as app] (/opt/homey-client/system/manager/ManagerApps/AppProcess/node_modules/@athombv/homey-apps-sdk-v3/lib/Homey.js:1:2133)
at Homey.destroy (/opt/homey-client/system/manager/ManagerApps/AppProcess/node_modules/@athombv/homey-apps-sdk-v3/lib/Homey.js:1:1689)
at IPCSocket.<anonymous> (/opt/homey-client/system/manager/ManagerApps/AppProcess/node_modules/@athombv/homey-apps-sdk-v3/lib/SDK.js:124:43)
at Object.onceWrapper (node:events:645:28)
at IPCSocket.emit (node:events:538:35)
at process.<anonymous> (/opt/homey-client/system/lib/IPCSocket.js:1:395)
at process.emit (node:events:538:35)
at finish (node:internal/child_process:922:14)
at processTicksAndRejections (node:internal/process/task_queues:78:11)
This model is already supported and the stacktrace you posted is not related to the Xiaomi app for Homey or support of this specific device. It's a somewhat descriptive error from Homey core. Just try again.