OpenBeken Provisioning.
As an enthusiastic user of HomeAssistant and Smart Home solutions in general, I am always into something new. Recently I’ve become acquainted with OpenBeken. Not wholly voluntary, but is a response to the fact that more Smart Home Devices started using BK7231 vs. good-old ESP82xx.
Undoubtedly I like the fact of being able to log in to a device and configure it to my needs. However, from a manageability perspective, you need the ability to mass-configure devices. When looking at phone provisioning and large-scale OS deployments, provisioning is standard. There is no way you can log in to 200 web interfaces and set individual settings.
Luckily for a few weeks, OpenBeken has introduced the “MQTT Group Topic,” which has eased our life tremendously.
Furthermore, the OpenBeken developers are actively adding configuration parameters with the ability to set them (up) using the MQTT “cmnd”. Combined with the “MQTT Group Topic,” I can now quickly configure multiple devices.
So why is this important to us? Well, let me start by using our own office as an example. Everyone knows about the high costs of electricity and the new rules coming from the EU regarding Co2 emissions and taxes. Saving on electricity consumption is directly impacting these costs. In our office, we have ceiling lights. About 25 of them. Each is equipped with 8 led lamps but still consumes around 100 Watts when lit. Multiply that by 25, and you have a whopping 2500 watts. We found that, on average, we only need ten ceiling lights powered on at any given moment is fine. Thus reducing our average usage by more than 50%. All our ceiling lights were connected to standard earthed sockets. Reason enough to buy 30 or so Smart Sockets. Initially, I tested the Woox R6080, and after sacrificing one unit, I got it running with OpenBeken. At about the same time, I successfully managed to get cloud-cutter to work, which made my work even more straightforward. It took away the need to desolder 25 Tuya boards.
I flashed all 34 Smart Plugs in two evenings. So now my real problems have begun. How to configure all these babies in bulk. I wasn’t planning on logging on to each device setting the required settings. So I started playing around with the same commands I used for bulk configuring my Tasmota devices. Unfortunately, not all the commands I needed were implemented at that time. Thanks to the developers, quite some features were added. But things really got up to speed once the MQTT Group Topic was introduced. This made it possible for me to update all 34 plugs in one go. As well as fine-tuning. This is a breeze as I have the same plugs and the same underlying hardware.
Let me show how I’ve done this;
Flash your device and add it to your WiFi network. No pin settings are needed; we will configure all settings from HomeAssistant.
First, I recommend choosing an MQTT Group Topic based on your hardware chip. This will make updating relatively easy and at least somehow prevent you from pushing N setting to T chips and vice versa. Setting up the MQTT Group Topic is done under “Configure MQTT.” Please make sure you set up your username and password correctly so HomeAssistant can “take control.”
To follow up on this, your Beken Device must report its status (regularly) to HomeAssistant. I recommend setting it up with a special Startup command. This is done in the Change Startup command text.
You should add “scheduleHADiscovery 10”
Now reboot your OpenBeken device and check if it shows up in HomeAssistant
We are now ready to configure the device.
Firmware update example.
Now that your device is integrated in HomeAssistent, you might want to update it remotely. Download the latest firmware and store it in a repository accessible via http. This can be a any type of http server. Let us assume your file resides on a local server with IP address 192.168.1.66 and is called fw.rbl. The URL for the update would http://192.168.1.6/fw.rbl. In HomeAssistant create a new script with the following settings;
For completeness the yaml code;
alias: OpenBeken Firmware Update
sequence:
- service: mqtt.publish
data:
topic: cmnd/BK7321N/ota_http
payload: http://192.168.1.66/fw.rbl
mode: single
icon: mdi:cellphone-arrow-down
When you run the script, it will request all OpenBeken devices subscribed to “BK732N” to download new firmware from the web server.
I want to focus on the “topic” and “payload,” as this is where the actual magic happens.
cmnd/BK7321N/ota_http
• cmnd instructs sending a command.
• BK7321N is the MQTT (group) Topic. If you want an individual update, use the MQTT Client/device name
• ota_http is the command your want to send. You can use the commands from https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands.md and from https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands-extended.md
I can tell, it is fun to watch 35 devices updating and rebooting. The aforementioned “scheduleHADiscovery” warrants that your HomeAssistant information is updated. When a new IP address is given or the firmware version changes, this is correctly displayed in HomeAssistant. So you can keep track of the firmware versions and see which devices are not up to date.
Another example is setting the Flags. Sometimes is handy to have flags set. For instance, I like flag 6 being set. This makes sure all relays are triggered instantly. I also have the desire setting flag 10. Setting both flags will give us a flag value of 1088.
Again, we will create a script that updates the flag settings.
Again small breakdown:
cmnd/bekens/ota_http
• cmnd instructs sending a command.
• bekens is the MQTT (group) Topic.
• flags the command we want to send
• payload 1088 in the case representing Flag 6 and Flag 10
Run the script and all your devices in the MQTT Group “bekens” will get these injected.
We can also setup the device using the backlog command. This allows us to send multiple commands to a device. Quite handy for setting up the configuration.
For example, setting up the Action LSC Smart Plugs
Pins are empty:
The device has Wifi set up, has MQTT Group setup, has scheduleHADiscovery set as startup command, and the device has MQTT host, user, and password setup.
Now configure all pins.
Yaml code:
o service: mqtt.publish
o data:
o topic: cmnd/obkBF518BE1/backlog
o payload: SetPinRole 6 LED_n;SetPinChannel 6,1;SetPinRole 7 Btn;SetPinChannel 7,1;SetPinRole 8 rel; SetPinChannel 8,1;SetPinRole 26 WifiLED; SetPinChannel 26,0
Run the script and:
Pins setup.
This shows the power of the MQTT Group Topic and the way the OpenBeken developers have come making provisioning a breeze. I am quite sure any future command or setting will be addressable via a MQTT cmnd command.
You can also play around with HomeAssistant templates, giving you even more power on the commands you want to execute.
I hope you enjoyed this write up on provisioning on OpenBeken.
As an enthusiastic user of HomeAssistant and Smart Home solutions in general, I am always into something new. Recently I’ve become acquainted with OpenBeken. Not wholly voluntary, but is a response to the fact that more Smart Home Devices started using BK7231 vs. good-old ESP82xx.
Undoubtedly I like the fact of being able to log in to a device and configure it to my needs. However, from a manageability perspective, you need the ability to mass-configure devices. When looking at phone provisioning and large-scale OS deployments, provisioning is standard. There is no way you can log in to 200 web interfaces and set individual settings.
Luckily for a few weeks, OpenBeken has introduced the “MQTT Group Topic,” which has eased our life tremendously.
Furthermore, the OpenBeken developers are actively adding configuration parameters with the ability to set them (up) using the MQTT “cmnd”. Combined with the “MQTT Group Topic,” I can now quickly configure multiple devices.
So why is this important to us? Well, let me start by using our own office as an example. Everyone knows about the high costs of electricity and the new rules coming from the EU regarding Co2 emissions and taxes. Saving on electricity consumption is directly impacting these costs. In our office, we have ceiling lights. About 25 of them. Each is equipped with 8 led lamps but still consumes around 100 Watts when lit. Multiply that by 25, and you have a whopping 2500 watts. We found that, on average, we only need ten ceiling lights powered on at any given moment is fine. Thus reducing our average usage by more than 50%. All our ceiling lights were connected to standard earthed sockets. Reason enough to buy 30 or so Smart Sockets. Initially, I tested the Woox R6080, and after sacrificing one unit, I got it running with OpenBeken. At about the same time, I successfully managed to get cloud-cutter to work, which made my work even more straightforward. It took away the need to desolder 25 Tuya boards.
I flashed all 34 Smart Plugs in two evenings. So now my real problems have begun. How to configure all these babies in bulk. I wasn’t planning on logging on to each device setting the required settings. So I started playing around with the same commands I used for bulk configuring my Tasmota devices. Unfortunately, not all the commands I needed were implemented at that time. Thanks to the developers, quite some features were added. But things really got up to speed once the MQTT Group Topic was introduced. This made it possible for me to update all 34 plugs in one go. As well as fine-tuning. This is a breeze as I have the same plugs and the same underlying hardware.
Let me show how I’ve done this;
Flash your device and add it to your WiFi network. No pin settings are needed; we will configure all settings from HomeAssistant.
First, I recommend choosing an MQTT Group Topic based on your hardware chip. This will make updating relatively easy and at least somehow prevent you from pushing N setting to T chips and vice versa. Setting up the MQTT Group Topic is done under “Configure MQTT.” Please make sure you set up your username and password correctly so HomeAssistant can “take control.”
![[Tutorial] Provisioning using HomeAssistant [Tutorial] Provisioning using HomeAssistant](https://obrazki.elektroda.pl/5659908500_1673038150_thumb.jpg)
To follow up on this, your Beken Device must report its status (regularly) to HomeAssistant. I recommend setting it up with a special Startup command. This is done in the Change Startup command text.
You should add “scheduleHADiscovery 10”
![[Tutorial] Provisioning using HomeAssistant [Tutorial] Provisioning using HomeAssistant](https://obrazki.elektroda.pl/9888758000_1673038231_thumb.jpg)
Now reboot your OpenBeken device and check if it shows up in HomeAssistant
![[Tutorial] Provisioning using HomeAssistant [Tutorial] Provisioning using HomeAssistant](https://obrazki.elektroda.pl/2293948200_1673038271_thumb.jpg)
We are now ready to configure the device.
Firmware update example.
Now that your device is integrated in HomeAssistent, you might want to update it remotely. Download the latest firmware and store it in a repository accessible via http. This can be a any type of http server. Let us assume your file resides on a local server with IP address 192.168.1.66 and is called fw.rbl. The URL for the update would http://192.168.1.6/fw.rbl. In HomeAssistant create a new script with the following settings;
![[Tutorial] Provisioning using HomeAssistant [Tutorial] Provisioning using HomeAssistant](https://obrazki.elektroda.pl/4552542900_1673038311_thumb.jpg)
For completeness the yaml code;
alias: OpenBeken Firmware Update
sequence:
- service: mqtt.publish
data:
topic: cmnd/BK7321N/ota_http
payload: http://192.168.1.66/fw.rbl
mode: single
icon: mdi:cellphone-arrow-down
When you run the script, it will request all OpenBeken devices subscribed to “BK732N” to download new firmware from the web server.
I want to focus on the “topic” and “payload,” as this is where the actual magic happens.
cmnd/BK7321N/ota_http
• cmnd instructs sending a command.
• BK7321N is the MQTT (group) Topic. If you want an individual update, use the MQTT Client/device name
• ota_http is the command your want to send. You can use the commands from https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands.md and from https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands-extended.md
I can tell, it is fun to watch 35 devices updating and rebooting. The aforementioned “scheduleHADiscovery” warrants that your HomeAssistant information is updated. When a new IP address is given or the firmware version changes, this is correctly displayed in HomeAssistant. So you can keep track of the firmware versions and see which devices are not up to date.
Another example is setting the Flags. Sometimes is handy to have flags set. For instance, I like flag 6 being set. This makes sure all relays are triggered instantly. I also have the desire setting flag 10. Setting both flags will give us a flag value of 1088.
Again, we will create a script that updates the flag settings.
![[Tutorial] Provisioning using HomeAssistant [Tutorial] Provisioning using HomeAssistant](https://obrazki.elektroda.pl/5938182300_1673038483_thumb.jpg)
Again small breakdown:
cmnd/bekens/ota_http
• cmnd instructs sending a command.
• bekens is the MQTT (group) Topic.
• flags the command we want to send
• payload 1088 in the case representing Flag 6 and Flag 10
Run the script and all your devices in the MQTT Group “bekens” will get these injected.
We can also setup the device using the backlog command. This allows us to send multiple commands to a device. Quite handy for setting up the configuration.
For example, setting up the Action LSC Smart Plugs
Pins are empty:
![[Tutorial] Provisioning using HomeAssistant [Tutorial] Provisioning using HomeAssistant](https://obrazki.elektroda.pl/5185384600_1673038531_thumb.jpg)
The device has Wifi set up, has MQTT Group setup, has scheduleHADiscovery set as startup command, and the device has MQTT host, user, and password setup.
Now configure all pins.
![[Tutorial] Provisioning using HomeAssistant [Tutorial] Provisioning using HomeAssistant](https://obrazki.elektroda.pl/1251231300_1673038571_thumb.jpg)
Yaml code:
o service: mqtt.publish
o data:
o topic: cmnd/obkBF518BE1/backlog
o payload: SetPinRole 6 LED_n;SetPinChannel 6,1;SetPinRole 7 Btn;SetPinChannel 7,1;SetPinRole 8 rel; SetPinChannel 8,1;SetPinRole 26 WifiLED; SetPinChannel 26,0
Run the script and:
![[Tutorial] Provisioning using HomeAssistant [Tutorial] Provisioning using HomeAssistant](https://obrazki.elektroda.pl/2304452100_1673038669_thumb.jpg)
Pins setup.
This shows the power of the MQTT Group Topic and the way the OpenBeken developers have come making provisioning a breeze. I am quite sure any future command or setting will be addressable via a MQTT cmnd command.
You can also play around with HomeAssistant templates, giving you even more power on the commands you want to execute.
I hope you enjoyed this write up on provisioning on OpenBeken.
Cool? Ranking DIY