rench / homebridge-smarthome

this is a homebridge plugin for mijia eco-chain but also a management webapp provide web and restapi to manage your mijia eco-chain,you can control and monitor your accessory via apple's homekit or the webapp
MIT License
39 stars 6 forks source link

Cannot set property #13

Open chips69 opened 6 years ago

chips69 commented 6 years ago

hi

i'm trying to get working homebridge-smart home

but whatever i do i get the same error after running homebridge -D

my config.json is correct i think

{ "bridge": { "name": "HOME-BRIDGE-DEV", "username": "9E:08:D9:DF:E9:31", "port": 51826, "pin": "031-45-154" }, "platforms": { "platform": "smarthome-mijia", "web": { "port": 8888 }, "mijia": { "sids": ["286c0785ef6a" ], "passwords": [ "mypassword" ]} } }

my error code

[12/1/2017, 1:28:01 AM] [homebridge-smarthome.smarthome-mijia] send msg->{ cmd: 'read', sid: '286c0785ef6a' } /node_modules/homebridge-smarthome/kit/mijia.js:274 gateway.devices[did] = this.devices[did]; ^

TypeError: Cannot set property '158d0001531ab7' of undefined at data.map (/node_modules/homebridge-smarthome/kit/mijia.js:274:32) at Array.map (native) at Mijia.parseMsg (/node_modules/homebridge-smarthome/kit/mijia.js:268:14) at Socket.udpScoket.on (/node_modules/homebridge-smarthome/kit/mijia.js:111:14) at emitTwo (events.js:106:13) at Socket.emit (events.js:194:7) at UDP.onMessage [as onmessage] (dgram.js:544:8)

the device '158d0001531ab7' is a temperature and humidy sensor V1

could you please help me

thanks for your work ^^

rench commented 6 years ago

What is the version number of your node.js?

phenomeus commented 6 years ago

hi rench, I get the same error.

`/usr/lib/node_modules/homebridge-smarthome/kit/mijia.js:274 gateway.devices[did] = this.devices[did]; ^

TypeError: Cannot set property '158d00010f05bb' of undefined at data.map (/usr/lib/node_modules/homebridge-smarthome/kit/mijia.js:274:32) at Array.map (native) at Mijia.parseMsg (/usr/lib/node_modules/homebridge-smarthome/kit/mijia.js:268:14) at Socket.udpScoket.on (/usr/lib/node_modules/homebridge-smarthome/kit/mijia.js:111:14) at emitTwo (events.js:106:13) at Socket.emit (events.js:191:7) at UDP.onMessage (dgram.js:548:8)`

and here the version of nodejs: nodejs -v v6.12.2

phenomeus commented 6 years ago

the ^ is below the "= equal" sign

rench commented 6 years ago

try update to 1.1.3

chips69 commented 6 years ago

Hello,

I solved my problem by changing the password.

previously I had put the password in lowercase, numbers and capital letters as in the gateway.

my problem disappeared by putting the password in uppercase.

Regards

phenomeus commented 6 years ago

@rench i was up to date with everything. sorry, saw its pretty fresh. will do and come back. thnks

phenomeus commented 6 years ago

@chips69 @rench unbelievable but the UPPERCASE Password was the trick… and maybe the update to 1.1.3! please provide this info in the readme!

but I still have a problem. please see log. what can I do?

[2017-12-15 21:48:27] [smarthome-mijia] mijia udp socket receive -> {"cmd":"read_ack","model":"gateway","sid":"286c07889900","short_id":0,"data":"{\"rgb\":0,\"illumination\":341,\"proto_version\":\"1.0.6\"}"} /usr/lib/node_modules/homebridge-smarthome/kit/mijia.js:328 this.gateways[sid].last_time = new Date(); ^

TypeError: Cannot set property 'last_time' of undefined at Mijia.parseDevice (/usr/lib/node_modules/homebridge-smarthome/kit/mijia.js:328:36) at Mijia.parseMsg (/usr/lib/node_modules/homebridge-smarthome/kit/mijia.js:304:14) at Socket.udpScoket.on (/usr/lib/node_modules/homebridge-smarthome/kit/mijia.js:111:14) at emitTwo (events.js:126:13) at Socket.emit (events.js:214:7) at UDP.onMessage [as onmessage] (dgram.js:658:8)

phenomeus commented 6 years ago

until the last error last_time is fixed I can use this fork: https://github.com/chilinh/homebridge-smarthome

is a merger not the best solution?

pax0707 commented 6 years ago

That worked for last_time. But crashes on enabling bridge light.

eshchar commented 4 years ago

i have the same problem.

{ "bridge": { "name": "Homebridge2", "username": "myusername", "port": 5353, "pin": "031-45-153" }, "description": "This is an example configuration file with gui. You can use this as a template for creating your own configuration file containing devices you actually own.", "accessories": [ ], "platforms": [{ "platform": "config", "name": "Config", "port": 8124, "sudo": true }, { "platform": "smarthome-mijia", "web": { "port": 8888 }, "mijia": { "sids": ["04cf8c97847b"], "passwords": ["mypassword"], "devices": [ { "sid": "Captain vacuum", "name": "Vacuum Cleaner", "ip": "192.168.50.52", "token": "mytoken", "type": "wifi", "model": "vacuum" } ] } }, { "platform": "smarthome-broadlink", "broadlink": { "devices": [ ] } } ] }

my error code

Got SIGTERM, shutting down Homebridge... TypeError: Cannot set property 'last_time' of undefined at Mijia.parseDevice (/usr/lib/node_modules/homebridge-smarthome/kit/mijia.js:328:36) at Mijia.parseMsg (/usr/lib/node_modules/homebridge-smarthome/kit/mijia.js:304:14) at Socket. (/usr/lib/node_modules/homebridge-smarthome/kit/mijia.js:111:14) at Socket.emit (events.js:196:13)