While installing the latest stable release of Tasmota32 (11.1.0) on a DualR3 Lite by Itead, I noticed that it supported Bluetooth Low Energy (BLE). Wanting that familiarize myself with that technology about which I knew next to nothing, I proceeded to waste a couple of hours of time. Tasmota was displaying messages from a BLE beacon, but no matter what I tried, it was not possible to trigger a rule which is about the only feasible way I could think of to send the beacon information on to my home automation system. In the end the solution was very simple: don't use the stable version, use the development version of Tasmota32-bluetooth (11.1.0.3) or, presumably, a subsequent stable release.
For the few that might be interested in how I went about testing this, here is some information.
First you need a beacon. There are IOS and Android apps, but I found something marginally more useful to do this. Called linux-beacon which is "[a] Python [2.7] script that creates an Apple® iBeacon®-compatible Bluetooth LE beacon using a computer running Linux and a Bluetooth LE adapter" according to the author Donald Burr (dburr). I wasn't too thrilled with the fact that the script did not run in Python 3, but I found two ports to Python 3 among the forks. I finally ended up reworking one of the ports for reasons explained in my fork. It is a simple matter to download the script to any computer equipped with a Bluetooth adapter and running a relatively recent copy Linux. This includes a Raspberry Pi 3 B running Raspberry Pi OS (buster) (i.e. Debian 10.8) and my desktop which is older than that Pi and which is running Mint 20.1. My version of the script named ibeacon
is easily downloaded.
Then make the downloaded script executable and start a beacon with it.
Open the Web interface of a device running at least version 11.1.0 of Tasmota32-bluetooth
. Click on the button, and then on the button.
In the Enter command
edit box, type the following backlog so115 1; ibeacon 1;. The setOption115 1
command enables Bluetooth. This can also be done from the Web interface main menu by clicking on the button, then clicking on the button, checking the Enable Bluetooth
box and, finally, clicking on the Save button.
Every 15 seconds or so, the beacon from the linux-beacon
will reach Tasmota and it will be echoed as an MQTT message on topic tele/newR3/SENSOR
(note that newR3
is a modified MQTT topic and you will see something different) as can be seen in the screen capture shown above. My home automation system does not subscribe to Tasmota MQTT tele/#
topics, so it was necessary to set up a rule to publish a meaningful MQTT message to the domoticz/in
topic.
Here is one of a number of possible rules. Enter it in the edit box under the console output window as before.
The response will be shown on the console.
which shows that the rule has been stored but that it is disabled ("State":"OFF"
). Enable the rule by entering the command
As can be seen, each MQTT message tele/newR3/SENSOR
from with the IBEACON
and containing the specified UID
generated by Tasmota in response to a BLE message from the linux-beacon
app gave rise to a domoticiz/in
message toggling a Domoticz light switch with idx 173. It is not particularly useful to toggle a lamp by my desk on and off every 15 seconds, but it proves that it works.
Again, this rule will not trigger if using the current release of Tasmota32
(version 11.1.0); it does work with version 11.1.0.3.
To stop the linux-beacon
, use the following command.
I do not have a real BLE sensor that would allow me to work out a meaningful example, but maybe the next ship in from the Far East will bring something along those lines. We'll see. Well that wasn't really a well thought out statement. An ESP32 can send BLE beacons. So I may be experimenting with BLE beacons sooner than I expected.