This project scans, automatically connects for nearby ITag devices and bridges their events to mqtt.
This BLE to MQTT bridge enables you to use you smart BLE tags with any smart home solution which uses MQTT either your own custom one or e.g. HomeAssistant
ITag is cheap <2€ BLE device equipped with button and piezzo buzzer.
sudo is needed to build noble dependencies
sudo yarn install
yarn start
See this link
itag/<tag uuid>/presence
emits values1
or0
if the device is connected or notitag/<tag uuid>/button/click
emits1
on button click and2
on button double-clicitag/<tag uuid>/rssi
emits the RSSI signal at a configured frecuencyitag/<tag uuid>/battery/level
emits the RSSI battery level at a configured frecuencyitag/<tag uuid>/alert/continuous
on payload:< miliseconds >
will perform a continuous piezzo aler for ms durationitag/<tag uuid>/alert/beep
on payload:< miliseconds >
will perform a beeping piezzo aler for ms duration
Is done using environment variales.
BEEP_ON_ITAG_CONNECT
default:true
-> tag will beep after connecting to your computerLOG_LEVEL
default:debug
(see: winston log levels)rssi_update_interval
default:15000
-> Value in ms at which the iTag's RSSI will be updateddouble_click_interval
default:800
-> Value in ms that sets the threshold for the second click to be read as a double-click actionhome_assistant
default:1
-> Enables or disables HomeAssistant MQTT auto-discoveryMQTT_BASE_TOPIC
default:itag
MQTT_URL
default:mqtt://localhost:1883
(see:mqtt.js format)MQTT_USERNAME
default:null
MQTT_PASSWORD
default:null
Note: ITag has some other services and characteristics available, below are listed only interesting ones
1802
-> Immediate Alert [ Alert Level ]1803
-> Link Loss [ Alert Level ]ffe0
-> Button [ Click ]
ffe1
-> Click [ notify ]2a06
-> Alert Level [ read write ]0x00
-> no alert0x01
-> mild alert (continuous)0x02
-> high alert (beeping)
At leat with current hardware (there are different iTag hardware iterations) there is a scenario where NOBLE connects with the TAG but fails to discover and subscribe to characteristics. Currently there is a rough approach to solve this by the UpdateRSSI function, but is a dirty one. If anyone could help refining this failsafe prodcedure, it would be great.