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

Error: Unknown event type #85

Closed
muscaiu opened this issue Nov 21, 2019 · 2 comments
Closed

Error: Unknown event type #85

muscaiu opened this issue Nov 21, 2019 · 2 comments

Comments

@muscaiu
Copy link

muscaiu commented Nov 21, 2019

I'm using the library to read the Mi sensor on a node js app and this is the whole code. i'm using.
It works correctly by logging the temp and humidity, but after 5-10 minutes it crashes.
Any idea why?

const { Scanner } = require("homebridge-mi-hygrothermograph/lib/scanner");

const livingId = '4c65a8dd7fc9';
const log = { debug() { }, error() { }, warn() { }, info() { } };
const livingScanner = new Scanner(livingId, { log });

try {
  livingScanner.on("temperatureChange", function (temperature, id) {
    console.log(temperature)
  });

  livingScanner.on("humidityChange", function (humidity, id) {
    console.log(humidity)
  });
} catch{
  livingScanner.on("error", error => console.log(error));
}


Error:

events.js:174
      throw er; // Unhandled 'error' event
      ^

Error: Unknown event type: 16. 5020aa0121c97fdda8654c100004df004402
    at Parser.parseEventData (/home/pi/soft/home-automation-api/node_modules/homebridge-mi-hygrothermograph/lib/parser.js:174:15)
    at Parser.parse (/home/pi/soft/home-automation-api/node_modules/homebridge-mi-hygrothermograph/lib/parser.js:56:23)
    at Scanner.parseServiceData (/home/pi/soft/home-automation-api/node_modules/homebridge-mi-hygrothermograph/lib/scanner.js:164:38)
    at Scanner.onDiscover (/home/pi/soft/home-automation-api/node_modules/homebridge-mi-hygrothermograph/lib/scanner.js:90:25)
    at Noble.emit (events.js:198:13)
    at Noble.onDiscover (/home/pi/soft/home-automation-api/node_modules/@abandonware/noble/lib/noble.js:178:10)
    at NobleBindings.emit (events.js:198:13)
    at NobleBindings.onDiscover (/home/pi/soft/home-automation-api/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:174:10)
    at Gap.emit (events.js:198:13)
    at Gap.onHciLeAdvertisingReport (/home/pi/soft/home-automation-api/node_modules/@abandonware/noble/lib/hci-socket/gap.js:256:10)
Emitted 'error' event at:
    at Scanner.parseServiceData (/home/pi/soft/home-automation-api/node_modules/homebridge-mi-hygrothermograph/lib/scanner.js:166:12)
    at Scanner.onDiscover (/home/pi/soft/home-automation-api/node_modules/homebridge-mi-hygrothermograph/lib/scanner.js:90:25)
    [... lines matching original stack trace ...]
    at Gap.onHciLeAdvertisingReport (/home/pi/soft/home-automation-api/node_modules/@abandonware/noble/lib/hci-socket/gap.js:256:10)
    at Hci.emit (events.js:198:13)
    at Hci.processLeAdvertisingReport (/home/pi/soft/home-automation-api/node_modules/@abandonware/noble/lib/hci-socket/hci.js:651:10)
@hannseman
Copy link
Owner

This is a duplicate of #56.

My current understanding of this issue is that something changed in the raspberry-pi firmware earlier this year and this broke a lot of bluetooth related stuff. Some people have seen improvement by upgrading to the latest firmware and others have resorted to buying external bluetooth adapters or upgrading to the RPI 4.

@muscaiu
Copy link
Author

muscaiu commented Nov 27, 2019

I was thinking of buying a RPI4 because of the 64 architecture, now you just gave me an extra reason!

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