Note: Please, be aware that this post may contain affiliate links.
Today, I’m going to be reviewing the BG Smart Socket. It’s not just any smart socket, but one that is cheap, reliable, aesthetically pleasing & WiFi (not RF) based.
Unfortunately, this is a UK only socket. Given that the company it’s from is called British General, I can’t see that changing either. Considering this is the companies first attempt at the smart home market, I think they have a winning item on their hands. This should not dissuade you, however, as they are a very well established electrical products manufacturer. You may even have some of their sockets/switches etc on your walls already.
I’ve had this socket now around 2 months, but have only just got around to integrating the socket into Home Assistant/NodeRED.
I will show you at the end of the post how to integrate the switch as a simple MQTT switch in Home Assistant (as well as other platforms).
Purchasing the BG Smart Socket
Currently, the best place to get the BG smart socket from is Amazon. They have it on Prime for a good price and it’s convenient.
There are other places to get it from if you don’t like shopping at Amazon. Here are the main places to buy the BG Smart Socket (that I’ve found, anyway).
|without delivery||delivered||affiliate link|
BG Smart Socket Images
Installing the socket
If you’ve installed a British electrical/mains socket before, this will be the same. If, however, you are in any doubt as to how to install an electrical socket into your electricity mains ring – please, please, PLEASE – consult a qualified electrician. Although I say that, I know that by the time you’ve paid an electrician to come out and fit a socket, you may as well have gone for
BG’s plug-in sister product
The BG apps
The app is clean enough, with the ability to toggle the power on either the entire unit or individual sockets.
Timers – It can set timers as is often expected.
Delay – One thing that I haven’t seen before is a delay function. This will allow you to turn off a specific socket after a set delay or one that you can enter yourself.
Random – It comes with the ability to randomise the power, obviously handy to have if you’re going away on holiday.
Maximum working times – This one could be good for things like Christmas decorations/outside lights etc. You can specify a maximum working time. This means if you set it to 8 hours, then turn your Christmas lights on at midday: #1 the lights will go out at 20:00 (8 pm) and 2# the kids will be miffed at you!
Names – Obviously you can give the different sockets names etc.
Device information – The app gives you a great deal of information such as
- Access to the cloud (this is perhaps an API key)
- Device IP
I don’t even know what the 1st 3 items on that list mean, but at least I know their values!
Device sharing – Once you’ve set your device up in the app, you can share it with family members etc via an on-screen QR code.
Room management – Devices can also be assigned to certain rooms
It is an app that you need an account to use and so any “local devices only” people will be disappointed.
The apps are available in the following app stores
Note: For some reason, the app won’t allow screenshots to be taken. I’m going to respect the developer’s wishes and not publish them. You can easily see some of the screenshots in the various app stores.
As the company is new to the smart home market, it is not surprising that they don’t have all the integrations we sometimes want. At the time of writing, they have the following integrations
- Amazon Alexa
- Google Assistant/home
IFTTT(I’m not sure on this one)
Can we control them locally?
I’ve described what follows in a YouTube video on the HASSCASTS channel, or you can carry on reading.
As it happens, the following tweet about this post, inspired me to look at the available local-only solutions.
Looks good, did you see if there was anyways to potentially flash another 3rd party firmware such as @esphome_ ? That’s if they are based on the ESP chip of course.— Ade Thompson (@apt) December 10, 2019
Now the BG Smart Socket is not controlled by the ESP8266, so we cannot control it with another one of our favourites: ESPHome, Tasmota etc
The chip inside the BG Smart Socket is actually a Broadlink chipset, and so it’s just a matter of getting the switch integrated into some software …or writing some ourselves.
Luckily someone has already done the work for us. So here are the instructions to get it working.
We will be using the GitHub repository broadlink-mqtt. If you are using a Mac or Linux, crank up your Terminal of choice and navigate to the place you like to store your custom code (or just a folder you will remember)
Clone the project into a directory of your choice & cd into it:
cd ~ # or directory of your choice git clone https://github.com/eschava/broadlink-mqtt.git cd broadlink-mqtt
Next, we need to install the dependencies. You may need to use sudo, depending on where pip keeps its packages. Always use caution when using elevated priveledges for something like this!
pip install -r requirements.txt
At the time of writing, this only installs 2 requirements, but one of them needs updating to register the BG Smart Socket. To do that, we first need to uninstall the python-broadlink library, followed by installing it with the pull request (PR) that includes the code that we need
pip uninstall python-broadlink pip install git+https://github.com/barnybug/python-broadlink@add_bgelectrical_sockets
Now copy the default config file and rewrite any values that we need to
cp mqtt.conf custom.conf
Then open up custom.conf and change the following value
Start the server
Now that everything is ready run
from your terminal/command line
Then you should see output indicating that it has found the BG1 socket. If it says that the device is “unknown”, the most likely reason is that the python-broadlink library is installed with the PR.
!504 $ ./mqtt.py [2019-12-15 19:26:14,697] DEBUG Connected to 'BG1' Broadlink device at '192.168.0.24' (MAC 06:91:86:42:f7:c8) and started listening for commands at MQTT topic having prefix 'broadlink/' [2019-12-15 19:26:16,023] DEBUG Connected to MQTT broker, subscribing to topic broadlink/# [2019-12-15 19:26:16,025] DEBUG Received MQTT message broadlink/power/2 off [2019-12-15 19:26:16,025] DEBUG Setting power state of socket 2 to False [2019-12-15 19:26:16,037] DEBUG Received MQTT message broadlink/BG1_86_91_06/power/2 on
Check your MQTT
Check your MQTT server and within around 30 seconds of starting the server, you should have a broadlink base topic there with the polled result of your socket. If not, go back and check your MQTT settings in the config file.
Create an MQTT switch in Home Assistant
Assuming you are using Home Assistant as your smart home hub, create a switch with the following details
switch: platform: mqtt name: "Monitor (Samsung)" state_topic: "broadlink/state/pwr2" command_topic: "broadlink/power/2" payload_on: "on" payload_off: "off" state_on: "1" state_off: "0" optimistic: false qos: 0 retain: true
The important points to note are:
Name: Name the switch anything you like
state_topic/command_topic: If there is just have 1 socket detected by python-broadlink, the topics will be as sown above. If not then there will be a separator (probably after broadlink. An example would be
where BG1_01_02_03 would involve part of your sockets MAC address as an identifier.
payloads/states: Note that the states that the library gives us are 1 or 0, but the payloads that you need to send the server are either on or off
I think this smart socket has enormous potential. One of the main missing features is some sort of public API that would allow easy integration into Home Automation software such as Home Assistant.
Even without a public API, for around the price of a plug-in adapter, you can get a replacement mains socket that isn’t just RF, but Wifi based. For me, this is a great opportunity to see what the home could be like if I had money for something like the Lightwave range of products.
Given the product/range is still quite new, I’m hoping that the developers will look into this in the future.
I’ve had one of these up and running now for a few months, and it has proven so far, to be reliable. Given the aesthetics of the product and the reputation of the manufacturer, it is not the only one that I will be purchasing.
I plan on getting some more of these in the future, and then I can do a more in-depth review with installation instructions etc.