binsentsu / am43-ctrl

Node Util for controlling an AM43 Blinds Drive Cover, either over MQTT or via a HTTP API
44 stars 25 forks source link

Discovered data char: "TypeError: Cannot read property 'on' of undefined" #12

Open alexcf opened 4 years ago

alexcf commented 4 years ago

Recently updated to the latest version.

2020-04-29T21:59:22.497Z am43:02d4146eaf57 discovered data char /usr/lib/node_modules/am43-ctrl/src/am43.js:117 characteristic.on('data', function (data, isNotification) { ^

TypeError: Cannot read property 'on' of undefined at discoveryResult (/usr/lib/node_modules/am43-ctrl/src/am43.js:117:32) at /usr/lib/node_modules/am43-ctrl/node_modules/@abandonware/noble/lib/peripheral.js:119:13 at Service. (/usr/lib/node_modules/am43-ctrl/node_modules/@abandonware/noble/lib/service.js:56:7) at Object.onceWrapper (events.js:417:26) at Service.emit (events.js:310:20) at Noble.onCharacteristicsDiscover (/usr/lib/node_modules/am43-ctrl/node_modules/@abandonware/noble/lib/noble.js:398:13) at NobleBindings.emit (events.js:310:20) at NobleBindings.onCharacteristicsDiscovered (/usr/lib/node_modules/am43-ctrl/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:368:8) at Gatt.emit (events.js:310:20) at Object.callback (/usr/lib/node_modules/am43-ctrl/node_modules/@abandonware/noble/lib/hci-socket/gatt.js:514:12)

Installed packages:

cat */package.json | jq '._from'

"abbrev@1" "accepts@~1.3.7" "ansi-regex@^2.0.0" "ansi-styles@^3.2.0" "aproba@^1.0.3" "are-we-there-yet@~1.1.2" "array-flatten@1.1.1" "async-limiter@~1.0.0" "balanced-match@^1.0.0" "base64-js@^1.0.2" "bindings@^1.4.0" "bl@^4.0.1" "body-parser@1.19.0" "brace-expansion@^1.1.7" "buffer-from@^1.0.0" "buffer@^5.5.0" "bytes@3.1.0" "callback-stream@^1.0.2" "camelcase@^5.0.0" "chownr@^1.1.1" "cliui@^5.0.0" "code-point-at@^1.0.0" "color-convert@^1.9.0" "color-name@1.1.3" "commist@^1.0.0" "concat-map@0.0.1" "concat-stream@^1.6.2" "console-control-strings@~1.1.0" "content-disposition@0.5.3" "content-type@~1.0.4" "cookie@0.4.0" "cookie-signature@1.0.6" "core-util-is@~1.0.0" "debug@^4.0.1" "decamelize@^1.2.0" "decompress-response@^4.2.0" "deep-extend@^0.6.0" "delegates@^1.0.0" "depd@~1.1.2" "destroy@~1.0.4" "detect-libc@^1.0.2" "d@1" "duplexify@^3.6.0" "ee-first@1.1.1" "emoji-regex@^7.0.1" "encodeurl@~1.0.2" "end-of-stream@^1.1.0" "es5-ext@~0.10.14" "es6-iterator@~2.0.1" "es6-map@^0.1.5" "es6-set@~0.1.5" "es6-symbol@~3.1.1" "escape-html@~1.0.3" "etag@~1.8.1" "event-emitter@~0.3.5" "expand-template@^2.0.3" "express@^4.16.3" "extend@^3.0.0" "ext@^1.1.2" "file-uri-to-path@1.0.0" "finalhandler@~1.1.2" "find-up@^3.0.0" "forwarded@~0.1.2" "fresh@0.5.2" "fs-constants@^1.0.0" "fs-minipass@^1.2.5" "fs.realpath@^1.0.0" "gauge@~2.7.3" "get-caller-file@^2.0.1" "github-from-package@0.0.0" "glob@^7.1.3" "glob-parent@^3.1.0" "glob-stream@^6.1.0" "has-unicode@^2.0.0" "help-me@^1.0.1" "http-errors@1.7.2" "iconv-lite@^0.4.4" "ieee754@^1.1.4" "ignore-walk@^3.0.1" "inflight@^1.0.4" "inherits@~2.0.3" "ini@~1.3.0" "ipaddr.js@1.9.1" "is-absolute@^1.0.0" "isarray@~1.0.0" "is-extglob@^2.1.0" "is-fullwidth-code-point@^1.0.0" "is-glob@^3.1.0" "is-negated-glob@^1.0.0" "is-relative@^1.0.0" "is-unc-path@^1.0.0" "is-windows@^1.0.1" "json-stable-stringify-without-jsonify@^1.0.1" "leven@^2.1.0" "locate-path@^3.0.0" "media-typer@0.3.0" "merge-descriptors@1.0.1" "methods@~1.1.2" "mime-db@1.44.0" "mime@1.6.0" "mime-types@~2.1.24" "mimic-response@^2.0.0" "minimatch@^3.0.4" "minimist@^1.2.5" "minipass@^2.8.6" "minizlib@^1.2.1" "mkdirp-classic@^0.5.2" "mkdirp@^0.5.1" "mqtt@^2.18.2" "mqtt-packet@^5.6.0" "ms@^2.1.1" "nan@^2.14.0" "napi-build-utils@^1.0.1" "napi-thread-safe-callback@0.0.6" "needle@^2.2.1" "negotiator@0.6.2" "next-tick@~1.0.0" "node-abi@^2.7.0" "node-addon-api@^2.0.0" "node-pre-gyp@^0.14.0" "noop-logger@^0.1.1" "nopt@^4.0.1" "npm-bundled@^1.0.1" "npmlog@^4.0.2" "npm-normalize-package-bin@^1.0.1" "npm-packlist@^1.1.6" "number-is-nan@^1.0.0" "object-assign@^4.1.0" "once@^1.3.0" "on-finished@~2.3.0" "ordered-read-streams@^1.0.0" "osenv@^0.1.4" "os-homedir@^1.0.0" "os-tmpdir@^1.0.0" "parseurl@~1.3.3" "path-dirname@^1.0.0" "path-exists@^3.0.0" "path-is-absolute@^1.0.0" "path-to-regexp@0.1.7" "p-limit@^2.0.0" "p-locate@^3.0.0" "prebuild-install@^5.3.3" "process-nextick-args@~2.0.0" "proxy-addr@~2.0.5" "p-try@^2.0.0" "pumpify@^1.3.5" "pump@^3.0.0" "qs@6.7.0" "range-parser@~1.2.1" "raw-body@2.4.0" "rc@^1.2.7" "readable-stream@^2.0.6" "readline-sync@^1.4.9" "reinterval@^1.1.0" "remove-trailing-separator@^1.0.1" "require-directory@^2.1.1" "require-main-filename@^2.0.0" "rimraf@^2.6.1" "safe-buffer@~5.1.1" "safer-buffer@>= 2.1.2 < 3" "sax@^1.2.4" "semver@^5.3.0" "send@0.17.1" "serve-static@1.14.1" "set-blocking@~2.0.0" "setprototypeof@1.1.1" "signal-exit@^3.0.0" "simple-concat@^1.0.0" "simple-get@^3.0.3" "split2@^2.1.1" "statuses@~1.5.0" "stream-shift@^1.0.0" "string_decoder@~1.1.1" "string-width@^1.0.1" "strip-ansi@^3.0.1" "strip-json-comments@~2.0.1" "tar-fs@^2.0.0" "tar@^4.4.2" "tar-stream@^2.0.0" "through2-filter@^3.0.0" "through2@^2.0.1" "to-absolute-glob@^2.0.0" "toidentifier@1.0.0" "tunnel-agent@^0.6.0" "typedarray@^0.0.6" "type-is@~1.6.18" "type@^1.0.1" "ultron@~1.1.0" "unc-path-regex@^0.1.2" "unique-stream@^2.0.2" "unpipe@1.0.0" "usb@^1.6.2" "util-deprecate@~1.0.1" "utils-merge@1.0.1" "vary@~1.1.2" "websocket-stream@^5.1.2" "which-module@^2.0.0" "which-pm-runs@^1.0.0" "wide-align@^1.1.0" "wrap-ansi@^5.1.0" "wrappy@1" "ws@^3.2.0" "xtend@^4.0.1" "y18n@^4.0.0" "yallist@^3.0.3" "yargs@^13.2.2" "yargs-parser@^13.1.2"

binsentsu commented 4 years ago

Looks like characteristic discovery for characteristic fe51 does not return a value in your installation. You have it all the time?

alexcf commented 4 years ago

I've just checked my logs for the last 48h (logrotate is on, so I can't go back further :/) and nothing showed up. I'll keep an eye on it.

alexcf commented 4 years ago

Had another one in the logs from a different device this time:

2020-05-01T08:50:46.544Z am43:02dec6987ad1 AM43 connected for data reading 2020-05-01T08:50:46.547Z am43:02dec6987ad1 discovered data char /usr/lib/node_modules/am43-ctrl/src/am43.js:117 characteristic.on('data', function (data, isNotification) { ^

TypeError: Cannot read property 'on' of undefined at discoveryResult (/usr/lib/node_modules/am43-ctrl/src/am43.js:117:32) at /usr/lib/node_modules/am43-ctrl/node_modules/@abandonware/noble/lib/peripheral.js:119:13 at Service. (/usr/lib/node_modules/am43-ctrl/node_modules/@abandonware/noble/lib/service.js:56:7) at Object.onceWrapper (events.js:417:26) at Service.emit (events.js:310:20) at Noble.onCharacteristicsDiscover (/usr/lib/node_modules/am43-ctrl/node_modules/@abandonware/noble/lib/noble.js:398:13) at NobleBindings.emit (events.js:310:20) at NobleBindings.onCharacteristicsDiscovered (/usr/lib/node_modules/am43-ctrl/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:368:8) at Gatt.emit (events.js:310:20) at Object.callback (/usr/lib/node_modules/am43-ctrl/node_modules/@abandonware/noble/lib/hci-socket/gatt.js:514:12)

binsentsu commented 4 years ago

Do you get any battery and position values into your mqtt broker/homeassistant? Haven't got this error a single time in 4 months log on 2 devices. Are you running on Rpi? I noticed that upgrading the bluez increases stability. The os packaging system mostly contains a pretty old version of bluez, while there are still some possibly relevant issues fixed. You can check version by performing ‘bluetoothctl -v’. Upgrade instructions: https://github.com/zewelor/bt-mqtt-gateway/wiki/Upgrade-Bluez-on-Raspbian.