plasticrake / tplink-smarthome-api

TP-Link Smarthome WiFi API
MIT License
1.02k stars 141 forks source link

Undefined (reading 'alias') only on ES20M #168

Closed shaarkys closed 3 months ago

shaarkys commented 3 months ago

Using this code : async getStatus() { try { this.plug = client.getPlug({ host: device }); await this.plug.getInfo().then((data) => { ....

Getting : Caught error in getStatus function: Cannot read properties of undefined (reading 'alias')

I thought it might be specific to some "quirked" ES20M but already two users with the same behavior. I don't have that device myself unfortunately.

plasticrake commented 3 months ago

Hard to help without providing the line that is throwing the error. What is the whole function?

shaarkys commented 3 months ago

I just realized something, let me test it - I will update it here later but maybe it's my code problem

shaarkys commented 3 months ago

Found the issue, the problem is that I missed GetSysinfo, apologies for noise from my side.

try { const sysInfo = await client.getSysInfo(device); this.plug = client.getPlug({ host: device, sysInfo: sysInfo }); await this.plug.getInfo().then((data) =>