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

BLE Xiaomi sniffer not working more #3

Closed
michapr opened this issue Oct 26, 2020 · 6 comments
Closed

BLE Xiaomi sniffer not working more #3

michapr opened this issue Oct 26, 2020 · 6 comments

Comments

@michapr
Copy link

michapr commented Oct 26, 2020

Not know what happen but sniffer give no more data.
Even after restart - or reboot (power off/on).

13:46:47.333 -> Loading HW settings
13:46:47.520 -> PSRAM found
13:46:47.520 -> Loading Pinout settings
13:46:47.566 -> Init network...
13:46:47.566 -> Init wifi STA
13:46:48.205 -> .
13:46:48.718 -> .
13:46:49.732 -> .
13:46:50.212 -> .
13:46:50.732 -> .
13:46:51.242 -> .
13:46:51.242 -> NTP time sync
13:46:51.452 -> Loading tasks
13:46:53.472 -> Loading controllers
13:46:54.022 -> 12:48:53: BLE sniffer init ok
13:46:54.072 -> 12:48:53: BLE sniffer init ok
13:46:54.111 -> 12:48:53: BLE sniffer init ok
13:46:54.152 -> 12:48:53: BLE sniffer init ok
13:46:54.198 -> 12:48:53: BLE sniffer init ok
13:46:54.452 -> 12:48:54: MQTT: Try to connect
13:46:54.852 -> Loading notifiers
13:46:54.922 -> 12:48:54: Event: System#Boot
13:46:55.011 -> Start mainloop
13:46:55.912 -> Starting webserver at 192.168.178.186
13:46:55.998 -> 12:48:55: Event: Clock#Time=Mon,12:48
13:47:01.132 -> 12:49:00: Event: Clock#Time=Mon,12:49
13:47:23.997 -> scan start
13:47:23.997 -> 16 sec
13:47:25.120 -> decode xiaomi error memoryview index out of rangescan pause
13:47:39.392 -> 
13:47:39.478 -> decode xiaomi error memoryview index out of range
13:47:39.616 -> decode xiaomi error memoryview index out of range
....
13:55:19.881 -> scan pause
13:55:50.343 -> scan start
13:55:50.343 -> 19 sec
13:55:51.972 -> decode xiaomi error memoryview index out of rangescan pause
13:56:08.382 -> 
13:56:08.507 -> decode xiaomi error memoryview index out of range
13:56:08.598 -> decode xiaomi error memoryview index out of range
13:56:08.732 -> 12:58:08: Event: esp-system#Uptime=557.0
13:56:08.998 -> 12:58:08: Event: esp-system#RAM=4044319.6
13:56:09.152 -> 12:58:08: Event: esp-system#wifirssi=-55.0
13:56:09.241 -> 12:58:08: Event: esp-system#CPU-Temp=46.7
13:56:09.622 -> {}
13:56:09.709 -> 12:58:09: Event: FlowerCare1#Temp=0.0
13:56:09.846 -> 12:58:09: Event: FlowerCare1#Moist=0.0
13:56:09.985 -> 12:58:09: Event: FlowerCare1#Fert=0.0
13:56:10.124 -> 12:58:09: Event: FlowerCare1#Light=0.0
13:56:10.450 -> {}
@enesbcs
Copy link
Owner

enesbcs commented Oct 26, 2020

Interesting. It looks like that "def decode_xiaomi(buf)" function tries to reach an index behind the buffer... can you narrow this error to a type of device? Lywsd02/Lywsd03/ATC... or what can be the one, who are sending smaller packages?
This function is the same as the RPIEasy version - although micropython works a bit differently.

@enesbcs enesbcs added the bug Something isn't working label Oct 26, 2020
@michapr
Copy link
Author

michapr commented Oct 26, 2020

Have removed all devices, enabled FlowerCare only - same result (after reboot)
Have removed all devices, enabled LYWSD02 only - same result (after reboot)
Have removed all devices, enabled CGG1 only - same result (after reboot)

Same also after power on/off, tested again with LYWSD02.

LYWSD02 with connection will work (if all sniffing devices disabled)

What I have seen, if I disable all "sniffing devices" and have only the system available (or additional BLE device with connection (LYWSD02) ) - still the scan process will be started until reboot.

@enesbcs
Copy link
Owner

enesbcs commented Oct 26, 2020

Have removed all devices, enabled FlowerCare only - same result (after reboot)
Have removed all devices, enabled LYWSD02 only - same result (after reboot)
Have removed all devices, enabled CGG1 only - same result (after reboot)

I have no idea. In the next release, buffer content will be printed.

What I have seen, if I disable all "sniffing devices" and have only the system available (or additional BLE device with connection (LYWSD02) ) - still the scan process will be started until reboot.

Scan process will never stop if started, it is by design. Different tasks do not check each other to know if it is the last one running.

@enesbcs
Copy link
Owner

enesbcs commented Oct 26, 2020

13:47:25.120 -> decode xiaomi error memoryview index out of rangescan pause

The problem is that i was used micropython 1.12 on my development device, and compiled against micropython 1.13... for a reason a few API changed in between.. and now memoryview type returnes some places, which is a major headache to me, as behaving differently compared bytes, bytearray or simple arrays.

@enesbcs
Copy link
Owner

enesbcs commented Oct 26, 2020

Second beta published. memoryview is now converted to other types.
https://github.com/enesbcs/mpyeasy/releases/tag/1.0.004

@michapr
Copy link
Author

michapr commented Oct 27, 2020

Is working now stable again since yesterday evening. Will tell you...

@enesbcs enesbcs removed the bug Something isn't working label Nov 15, 2020
@enesbcs enesbcs closed this as completed Nov 16, 2020
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

2 participants