itag-mqtt-bridge
itag-mqtt-bridge copied to clipboard
After a connection I got the error: _TypeError: Cannot read property 'write' of undefined
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.
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
Hi,
Thank you for your looking into the code, and also bringing this up.
Seem that China never disappoints with its diversity. Also when it comes to small BLE trackers. :-)
The reason for the disabling the Link Loss is that my specific device had a LinkLoss feature enabled by default. When the connection was interrupted by turning of the mqtt bridge app, or by simply walking too far from the raspberry, my device would start beeping. Thats not exactly the use case i wanted.
Where did you get your BLE tag, would you mind sharing a reference (link to e-shop)?
Thanks, Tomas