Skip to content

After a connection I got the error: _TypeError: Cannot read property 'write' of undefined #1

@BjarkeVadPedersen

Description

@BjarkeVadPedersen

Hi,

Thank you for a nice script, got the functionality up and running with home assistant.

Just a few notes on what I experienced:
I had to change the name of the expected device from ITAG to iTAG to get the script to do the connection. I guess the devices vary in name.

Also initially after a connection I got the error:
TypeError: Cannot read property 'write' of undefined
at peripheral.discoverAllServicesAndCharacteristics (/home/pi/itag-mqtt-bridge/src/index.js:74:33)
at Peripheral. (/home/pi/node_modules/noble/lib/peripheral.js:101:13)
at Service. (/home/pi/node_modules/noble/lib/service.js:53:7)
at Object.onceWrapper (events.js:293:19)
at emitOne (events.js:96:13)
at Service.emit (events.js:191:7)
at Noble.onCharacteristicsDiscover (/home/pi/node_modules/noble/lib/noble.js:261:13)
at emitThree (events.js:116:13)
at NobleBindings.emit (events.js:197:7)
at NobleBindings.onCharacteristicsDiscovered (/home/pi/node_modules/noble/lib/hci-socket/bindings.js:339:8)

which I solved by uncommenting the relevant lines after line 74:

//linkLossAlertLevelCh.write(new Buffer([itag_characteristic_alertLevel_value_noAlert]), true, (error)=>{
// if(error) log.error(error)
// log.debug(ITAG peripheral id: ${peripheral.id} LinkLoss AlertLevel write success)
// if(beep_on_itag_connect==='true') alertITAGContinous(peripheral.id,200)
// });

I am not sure if this error is only related to my specific installation.

/Bjarke

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions