Configuring Tasmota/Portisch in Sonoff RF-bridge (continued)This guide is a continuation of:Connect your device to Wi-Fi
After writing the Tasmota image to the microcontroller, we need to restart the device. To do this, we need to disconnect from the power and reconnect it. The device will create a Wi-Fi network with a name similar to tasmota-xxxxx-xxx. The characters xxxxx will vary depending on the identifier of each device.
We connect to that network and enter the following IP address into the browser: 192.168.4.1
When you log in, the Wi-Fi setup screen will probably appear. There you can enter your network data, such as the network name in the AP1 SSID field and the password in AP1 Password.
Press the Save button to save the data. The device will restart automatically. If the main screen of Tasmota appears directly when entering the IP address, we can configure the Wi-Fi network from the Configuration menu.
Then we go into Configure WiFi, add our network SSID and password, and press Save. We wait for the device to restart.
The next step requires having access to the Wi-Fi access point or router of our network, to consult the connected devices and know the IP address that has been assigned to the Sonoff RF Bridge. Once we know your IP address, we can access it again from the browser and continue with the configuration. Important: if they can already access the device and check that Tasmota is working properly, they can remove the serial adapter, as it will not be necessary for the next steps.
1.1. Set a fixed IP addressIt is always advisable to assign a fixed IP address to the device. In this way, we avoid having to look for its address on the router every time we need to access the configuration. Tasmota allows you to set a fixed IP address using commands from your console. Below, I show the values I used in my installation. They should replace them with those that correspond to their own network. To access the console, enter the Console from the main menu.
In my case, I used the following commands: Assign the IP address of the device:
|
| Terminal |
$ IPAddress1 192.168.1.13 |
|
|
Configure the network gateway:
|
| Terminal |
$ IPAddress2 192.168.1.1 |
|
|
Configure the subnet mask:
|
| Terminal |
$ IPAddress3 255.255.255.0 |
|
|
Restart the device:
After rebooting, we can now access the device using the new IP address.
2. Configure the module for Sonoff RF Bridge
Enter Configure Module from the settings menu. Select the Sonoff Bridge option (25), press Save and wait for the device to restart.
3. Set up device identification
To facilitate the identification of the device within our network, Tasmota has two configuration options. The first one is located in the Wi-Fi settings section. There we can modify the Hostname field and press Save.
The second option is found in: Configuration → Configure Other
In this section we can define a name in the Device Name field. Finally, we press Save to save the changes and restart the device.
4. Install the Portisch firmware
4.1. Prepare the plateTo install this firmware it is necessary to add two temporary jumpers on the board. The connections depend on the hardware revision:
- R1: Connect GPIO4 with C2CK and GPIO5 with C2D
- R2: Connect GPIO4 with C2D and GPIO5 with C2CK
It should be noted that the text on the screen print on the R2 plate is interchanged. Therefore, the connections indicated for R2 correspond to the same wiring used in R1.
4.2. Deactivating the DeviceWe set the ON/OFF switch on the board to the OFF position.
4.3. Accessing SettingsWe connect the Sonoff RF Bridge to the power supply and access its web interface from the browser.
4.4. Update the firmwareTo install the firmware, we enter the Firmware Upgrade option.
Open the dialog box to select the file from the Upgrade by file upload option.
We must select the file that is inside the Tasmota repository that we downloaded from GitHub at the beginning of the procedure.
The file is called: RF-Bridge-EFM8BB1-20190220.hex
Its location within the project is: Tasmota-master/tools/fw_SonoffRfBridge_efm8bb1
We press Start upgrade and wait for the procedure to finish. Once completed, the device will restart.
5. Receive and output raw RF-433 signals
To check that the device has the new functionalities, we must enter the Tasmota console and execute the following command:
This will put the device into listening mode and allow digital data to be obtained from the received radio frequency signals. To perform the test we need a radio frequency transmitter. In my case, I used a typical four-button remote control, like those used to open electric gates. By pressing the buttons on the remote control, we will be able to observe the data that the microcontroller interprets.
Ideally, you should hold down the same button for several seconds. We will notice that, sometimes, the data presents small variations. This can be due to interference, so it is advisable to identify and use the information that remains more constant during captures.
6. Emitting radio frequency signals
To emit radio frequency signals, we must first transform the captured data into a valid B0 format. To do this, we need to download the original Portisch project and run the Python 3 script that is included in it. This script requires some dependencies installed on your computer: Python 3, Pip, pycurl, and Pillow. In OS X, to install these dependencies we first need to have Homebrew. You can install it by following the corresponding guide. Once Homebrew is installed, we can continue with the installation of Python 3, Pip and the other dependencies.
Install Python 3:
|
| Terminal |
$ brew install python3 |
|
|
If the above command doesn't work, we can try with:
|
| Terminal |
$ brew install --build-from-source python@3.9 |
|
|
|
| Terminal |
$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
$ python get-pip.py |
|
|
|
| Terminal |
$ brew reinstall openssl
$ pip uninstall pycurl
$ pip install --install-option="--with-openssl" --install-option="--openssl-dir=/usr/local/opt/openssl" pycurl |
|
|
|
| Terminal |
$ pip install Pillow |
|
|
Once Python 3 and its dependencies are installed, we can run the script. The file is called BitBucketConverter.py and we need to run it as follows:
|
| Terminal |
$ python3 BitBucketConverter.py |
|
|
The script will request the captured data as input and then return the converted information to the B0 format, ready to be used by the Sonoff RF Bridge.
We paste the data we captured earlier, the contents of which begin with AA B1.... The program will return the converted data, which starts with AA B0....
Now we can return to the Tasmota console for a test.
Now we go to the Tasmota console to perform a testThe command we must use for the SonOff to emit a replica of the captured rf signal is:
|
| Terminal |
$ RfRaw <data B0>; RfRaw 0; |
|
|
Example:
If all went well, our SonOff RF-Bridge device should correctly emit an RF signal.
7. Send an HTTP GET request
To make this RF bridge useful, we can control it via MQTT or HTTP. In my case, I prefer to use an HTTP request, as this way I don't need to keep an MQTT messaging service running. I can simply establish a connection whenever I need it. A simple way to do this is to directly access the IP address of the Sonoff RF Bridge and send as a parameter the command that we want Tasmota to execute. The structure of the application is as follows:
|
| Terminal |
$ <IP-SonOff>/cm?cmnd=Backlog RfRaw <data B0>; RfRaw 0; |
|
|
We can also make this request directly from the browser's address bar.
If everything has gone well, our Sonoff RF Bridge should execute the requested command. Shadow Fiend ewrwe
|
|
|