Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is it possible to disable gateway discovery and minitoring? #19

Closed
fxdpz opened this issue May 8, 2017 · 12 comments
Closed

is it possible to disable gateway discovery and minitoring? #19

fxdpz opened this issue May 8, 2017 · 12 comments

Comments

@fxdpz
Copy link

fxdpz commented May 8, 2017

i am using homebridge-aqara to control ctrl_neutral1 and get sensor data from temperature, humidity and motion status, and using homebridge-miio to control chuangmi.plug.m1 and zimi.powerstrip.v2. i found a strange thing, at night my ctrl_neutral1 switch and motion sensor will disappear from home app, and if motion sensor is triggered or trun on ctrl_neutral1 switch, ctrl_neutral1 and motion sensor will come back to home app, but it will revert to default name with some hex digit and default room.
i turn on debug and found no error. is it possible that miio library conflicts with homebridge-aqara plugin?
is it possible to disable gateway discovery and minitoring, so i can do a test?

PS: homebridge-miio plugin version is 0.2.1 and miio library version is 0.7.0.

@aholstenson
Copy link
Owner

I don't think there should be any conflict since 0.1.12 of homebridge-aqara. I'm unable to test this as I'm not a Homebridge or iOS user.

You can probably filter out devices in homebridge-miio somehow as that library controls which devices it connects to and which ones it keeps being connected to. miio in itself only provides the communication with the devices and doesn't provide any names.

Does removing the homebridge-miio plugin help? If the Aqara-devices are still removed it might be an issue with homebridge-aqara.

@Gromina
Copy link
Contributor

Gromina commented May 8, 2017

From my experience, only one developer API connection can be established at given moment. Probably both pieces of software conflict since they both use developer connection

@fxdpz
Copy link
Author

fxdpz commented May 9, 2017

@aholstenson thx for response. my suspicion cames from debug log. when i turn on debug, i found that miio library connect to gateway every five minutes. debug log is as followed:
May 08 04:04:11 rpb1 homebridge[1509]: Sun, 07 May 2017 20:04:11 GMT miio.device.52232795 DEV <- {"cmd":"iam","port":"9898","sid":"286c077773d6","model":
May 08 04:04:11 rpb1 homebridge[1509]: Sun, 07 May 2017 20:04:11 GMT miio.device.52232795 DEV -> {"cmd":"get_id_list"}
May 08 04:04:11 rpb1 homebridge[1509]: Sun, 07 May 2017 20:04:11 GMT miio.device.52232795 DEV <- {"cmd":"get_id_list_ack","sid":"286c078883d6","token":"m
May 08 04:04:11 rpb1 homebridge[1509]: Sun, 07 May 2017 20:04:11 GMT miio.device.52232795 DEV -> {"cmd":"read","sid":"286c078883d6"}
May 08 04:04:11 rpb1 homebridge[1509]: Sun, 07 May 2017 20:04:11 GMT miio.device.52232795 DEV -> {"cmd":"read","sid":"158d00015618e0"}
May 08 04:04:11 rpb1 homebridge[1509]: Sun, 07 May 2017 20:04:11 GMT miio.device.52232795 DEV -> {"cmd":"read","sid":"158d00015ae3d2"}
May 08 04:04:11 rpb1 homebridge[1509]: Sun, 07 May 2017 20:04:11 GMT miio.device.52232795 DEV -> {"cmd":"read","sid":"158d00014cf5bf"}
May 08 04:04:11 rpb1 homebridge[1509]: Sun, 07 May 2017 20:04:11 GMT miio.device.52232795 DEV <- {"cmd":"read_ack","model":"gateway","sid":"286c078883d6"
May 08 04:04:11 rpb1 homebridge[1509]: Sun, 07 May 2017 20:04:11 GMT miio.device.52232795 DEV <- {"cmd":"read_ack","model":"sensor_ht","sid":"158d0001561
May 08 04:04:11 rpb1 homebridge[1509]: Sun, 07 May 2017 20:04:11 GMT miio.device.52232795.158d00015618e0 Property temperature changed from undefined to 2
May 08 04:04:11 rpb1 homebridge[1509]: Sun, 07 May 2017 20:04:11 GMT miio.device.52232795.158d00015618e0 Property humidity changed from undefined to 30.7
May 08 04:04:11 rpb1 homebridge[1509]: Sun, 07 May 2017 20:04:11 GMT miio.device.52232795 DEV <- {"cmd":"read_ack","model":"motion","sid":"158d00015ae3d2
May 08 04:04:11 rpb1 homebridge[1509]: Sun, 07 May 2017 20:04:11 GMT miio.device.52232795.158d00015ae3d2 Property voltage changed from undefined to 3035
May 08 04:04:11 rpb1 homebridge[1509]: Sun, 07 May 2017 20:04:11 GMT miio.device.52232795 DEV <- {"cmd":"read_ack","model":"ctrl_neutral1","sid":"158d000
May 08 04:04:11 rpb1 homebridge[1509]: Sun, 07 May 2017 20:04:11 GMT miio.device.52232795.158d00014cf5bf Property channel_0 changed from undefined to fal
May 08 04:04:11 rpb1 homebridge[1509]: Sun, 07 May 2017 20:04:11 GMT miio.device.52232795.158d00014cf5bf Property power changed from undefined to [ false
May 08 04:04:13 rpb1 homebridge[1509]: Sun, 07 May 2017 20:04:13 GMT miio.packet -> <Buffer 21 31 00 60 00 00 00 00 03 49 bd df 00 14 b8 13 5c 26 6b 6a 6
May 08 04:04:13 rpb1 homebridge[1509]: Sun, 07 May 2017 20:04:13 GMT miio.device.55164383 -> (3) {"id":2426,"method":"get_prop","params":["power"]}

about message repeated every about five minutes.

i comment out some line in file models.js and the device didn't go off:

/usr/local/lib/node_modules/homebridge-miio/node_modules/miio/lib/models.js

//const Gateway = require('./devices/gateway');
//'lumi.gateway.v2': Gateway,
//'lumi.gateway.v3': Gateway,

after one night, the sensor and the siwtch remains.

@aholstenson
Copy link
Owner

Thanks for debug log! There are two issues here I think:

  1. That homebridge-miio connects to the gateway that often. Maybe @Bluebie has any ideas about what's happening there?

  2. That several instances can't talk with the gateway at the same time. I'll look into this and see what goes wrong with the local developer connection and if there is any way of having several instances talk to the API at the same time.

@fxdpz
Copy link
Author

fxdpz commented May 10, 2017

Thx for response. after two nights, the devices didn't disappear from home app. maybe the problem is as @Gromina said that only one developer API connection can be established at given moment, and at a given point homebridge-aqara thinks that the devices is offline.

since miio library supports zigbee devices, it'll be great that if @Bluebie's homebridge-miio can support zigbee devices, and one plugin will cover all xiaomi devices.

@aholstenson
Copy link
Owner

Good to hear! I'm currently looking at an alternative way to get the devices from the gateway so that I can avoid using most of the developer API.

For now I've found a call that will list the devices, but some more work is needed to figure out how to map those devices to proper implementations. Hoping to have something for testing soon though.

@fxdpz
Copy link
Author

fxdpz commented May 11, 2017

since i have found the solution for the problem, i'll close the issue.
thx @aholstenson @Gromina.

@fxdpz fxdpz closed this as completed May 11, 2017
@sangkooki
Copy link

@fxdpz

What's your solution?

I'm wondering. I've been same problem.

@aholstenson
Copy link
Owner

aholstenson commented May 11, 2017

@sankooki I think @fxdpz removed a few lines from homebridge-miio/node_modules/miio/lib/models.js to disable the special handling of gateways in miio. Those lines are should be the ones starting with lumi.gateway.

If you are still having issues you should probably open an issue in the homebridge-miio repository so that it can be updated to avoid connecting to the gateway.

@aholstenson
Copy link
Owner

I'm opening a new issue to track a new way to implement support for the Smart Home Gateway that should solve this issue in time. Please have a look at and follow #26 if you are interested in helping with that.

@fxdpz
Copy link
Author

fxdpz commented May 11, 2017

@sankooki , what i did is as @aholstenson said.

@sangkooki
Copy link

@aholstenson @fxdpz Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants