![]() The Lights Project Bluetooth BLE Tracker as a light switchby Dalibor Lanik ![]() |
In my lights project,
I needed to add a button to make switching
the lights easier. Even though the tablet
used to switch on/off the lights turns
itself on when it's front camera detects
movement, sometimes it is just easier to
press the button. So I did research on
buttons. The first thing that came to mind
was direct WiFi communication,
since the bulbs are Xiaomi Yeelights that
connect by WiFi and can be controlled
directly, but since these WiFi buttons are
pretty expensive, I dropped that. Next idea
was to use hacked Amazon Dash, but it is
unavailable in the Czech Republic. It can be
ordered from Germany or Austria, but add to
the already higher price the price of
shipping and it also becomes a bit
expensive. Also, from everything I've read
online, these buttons have delay of like 3-5
seconds, since the WiFi is off in order to
save battery, and when you press the button,
it needs to turn WiFi on, connect to the
router and send the packet to announce it's
presence.
![]() ![]() So I said the hell with WiFi, let's try Bluetooth. There are a lot of cheap Bluetooth BLE (Bluetooth Low Energy) trackers available from China (i.e. Ali Express). You can get them as low as 2$ apiece including shipping! Turns out I was right. Works beautifully, once you sort out all technical details :) First of all you need a tag that looks like a button, not like a key chain. These devices have CR2032 battery and it is changeable, I still don't know how long it lasts. ![]() First thing you need is to find the software that works with these tags. And that is the hardest part. First of all, if you are not familiar with BLE devices - it came as a surprise for me - these devices do not pair. There are numerous apps on Google Play that show the specs and stats of BLE devices, but none do anything useful. There are apps that work like "out of the box" - for basic stuff ordinary users need, like trigger the camera or set alarm when connection is lost etc, but this is not what we need. We need an app to send a signal to Tasker or such. After 30 minutes of googling, I managed to find one! One and only :) iTracing2. ![]() ![]() This app is not only able to find and connect to your BLE tracker device, but can also react on events; there are following events: Single click, double click, connected and connection lost. And more important - it can do stuff on these events. The most important one - send intent to Tasker, which means that then you can do whatever you want from Tasker, like turn on or off your lights. ![]() First of all, you need to find the device in iTracing. You will see device's name and MAC address. Then you can check it (means it is being tracked) and press device name to set it's options. As I said, set intents to Tasker for click, double click, and connected and disconnected if you want. The intents are as follows: click - net.sylvek.itracing2.itag.button double click - net.sylvek.itracing2.action.doubleclick connected - net.sylvek.itracing2.action.connected connection lost - net.sylvek.itracing2.action.outofrange Now, all you have to do is set the same events for intent received in Tasker, and you can react to the click from the BLE tag! ![]() CONCLUSION
For the price, ease of
setup and performance, there is no better
solution. At (if you search or buy more
pieces) around 2$ a item and almost
immediate reaction to press, these buttons
are hard to beat.
|
![]() |