In the need of a socket-outlet controlled via bluetooth

semar

Active Member
Licensed User
Longtime User
Dear all,
I would like to switch a lamp on and off with a B4A app running on an android smartphone. The lamp should be connected to a socket-outlet controlled via bluetooth.

Are there any socket-outlet that are easy to interface with ? I mean a model which can be plugged in a home socket-outlet present in any house, and has itself an outlet where the lamp plug should be inserted in.

My goal ist to develop an app in order to control many different spotlights at home, each one plugged in a different outlet having its bluetooth channel. I don't want use any wlan, only bluetooth.

Do someone of you have already some experience with such devices ?

Thanks in advance,
Sergio
 

canalrun

Well-Known Member
Licensed User
Longtime User
Dear all,
I would like to switch a lamp on and off with a B4A app running on an android smartphone. The lamp should be connected to a socket-outlet controlled via bluetooth.

Are there any socket-outlet that are easy to interface with ? I mean a model which can be plugged in a home socket-outlet present in any house, and has itself an outlet where the lamp plug should be inserted in.

My goal ist to develop an app in order to control many different spotlights at home, each one plugged in a different outlet having its bluetooth channel. I don't want use any wlan, only bluetooth.

Do someone of you have already some experience with such devices ?

Thanks in advance,
Sergio

This is not quite what you are asking about, but a company called LifX has Wi-Fi controllable lamp bulbs and floodlight bulbs and I believe they may also have Wi-Fi controllable outlets.

They have an interface that uses your Wi-Fi local area network and UDP packets to control their devices (they call it LAN API). It's arguable that using Wi-Fi is better than Bluetooth for ease-of-use and distance – but that's probably just opinion.

I have just completed a test application for B4J that does some very basic commands – like turning a bulb on or off.

The application uses jNetwork and UDP sockets in B4J, but it would be easily transferable to B4A.

Let me know if this might be of interest and I will send you the B4J code I have for the test application.

Barry.
 

sorex

Expert
Licensed User
Longtime User
indeed, you won't get far with bluetooth as the distance is just a few meters if you're lucky.

you'll need rf or wifi based lamps or sockets but most of them come with their own app already.
 

semar

Active Member
Licensed User
Longtime User
This is not quite what you are asking about, but a company called LifX has Wi-Fi controllable lamp bulbs and floodlight bulbs and I believe they may also have Wi-Fi controllable outlets.

They have an interface that uses your Wi-Fi local area network and UDP packets to control their devices (they call it LAN API). It's arguable that using Wi-Fi is better than Bluetooth for ease-of-use and distance – but that's probably just opinion.

I have just completed a test application for B4J that does some very basic commands – like turning a bulb on or off.

The application uses jNetwork and UDP sockets in B4J, but it would be easily transferable to B4A.

Let me know if this might be of interest and I will send you the B4J code I have for the test application.

Barry.
@Barry
Hi Barry,
many thanks for your infos.

Yes I'm interested to the B4J code, it would be nice to have a simple working example just to turn on and off some lamp. I've shared my e-mail address in a conversation with you.

@sorex,
many thanks you too for your hint.

Best Regards,
Sergio
 

KMatle

Expert
Licensed User
Longtime User

semar

Active Member
Licensed User
Longtime User
Thank you for your suggestions so far.
@KMatle,
yes this is also a good and viable solution, I'll consider it for further development.

[EDITED]
 
Last edited:

thetahsk

Active Member
Licensed User
Longtime User
A solution for your task.
  • Wireless Socket, Bluetooth XAVAX 111970, 3500W,230V,Model HAMA-111970,Barcode 4047443271761, coverage up to 10m.(sold by pollin.de in Germany for 10€).
 

semar

Active Member
Licensed User
Longtime User
A solution for your task.
  • Wireless Socket, Bluetooth XAVAX 111970, 3500W,230V,Model HAMA-111970,Barcode 4047443271761, coverage up to 10m.(sold by pollin.de in Germany for 10€).
Thank you thetahsk, indeed an interesting device !!

However I wonder if this socket-outlet is also programmable from withn B4A/I/X..

In the description there's no mention of an available API.
 

semar

Active Member
Licensed User
Longtime User
You can use the "Bluetooth sniffing" for reverse engineering the communication protocol.

e.g. https://github.com/virtualabs/btlejack


Btlejack provides everything you need to sniff, jam and hijack Bluetooth Low Energy devices. It relies on one or more BBC Micro:Bit. devices running a dedicated firmware. You may also want to use an Adafruit's Bluefruit LE sniffer or a nRF51822 Eval Kit, as we added support for these devices.
That's indeed very interesting, I didn't know there are Bluetooth sniffer !! While this is a fascinating technology, I must admit it's quite beyond my knowledgements..
Anyway, really interesting thetahsk, thank you very much for pointing this out !!
Wait a moment.. would be possible to make such a Bluetooth sniffer using B4X/A/I ?
Me thinking..
 

thetahsk

Active Member
Licensed User
Longtime User
That's indeed very interesting, I didn't know there are Bluetooth sniffer !! While this is a fascinating technology, I must admit it's quite beyond my knowledgements..
Anyway, really interesting thetahsk, thank you very much for pointing this out !!
Wait a moment.. would be possible to make such a Bluetooth sniffer using B4X/A/I ?
Me thinking..

On the Android devices you must enable "Bluetooth capturing" and after copying the btsnoop_hci.log file to your PC you can open the binary file with Wireshark.
 

semar

Active Member
Licensed User
Longtime User
On the Android devices you must enable "Bluetooth capturing" and after copying the btsnoop_hci.log file to your PC you can open the binary file with Wireshark.
I'm pulling my hear out by trying to find the option "Bluetooth capturing" on my Samsung Galaxy Alpha.. :confused:
[EDIT]
Never mind, I've found it !
 
Last edited:

thetahsk

Active Member
Licensed User
Longtime User
I'm pulling my hear out by trying to find the option "Bluetooth capturing" on my Samsung Galaxy Alpha.. :confused:
[EDIT]
Never mind, I've found it !
And don't forget to disable the "Bluetooth capturing" after your work is done. Otherwise the size of the file converts to positive infinity.
 
Top