In the need of a socket-outlet controlled via bluetooth

Discussion in 'Chit Chat' started by semar, Jan 28, 2019.

  1. semar

    semar Active Member Licensed 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,
  2. canalrun

    canalrun Well-Known Member Licensed 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.

  3. sorex

    sorex Expert Licensed 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.
    Peter Simpson likes this.
  4. semar

    semar Active Member Licensed User

    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.

    many thanks you too for your hint.

    Best Regards,
  5. KMatle

    KMatle Expert Licensed User

    You can by several ESP8266 based switches on Ebay for less than 10€. Flash them with a small B4R program. At home it connects to your router. Also your app. Use asyncstreams and you're good.
  6. semar

    semar Active Member Licensed User

    Thank you for your suggestions so far.
    yes this is also a good and viable solution, I'll consider it for further development.

    Last edited: Feb 6, 2019
  7. thetahsk

    thetahsk Active Member Licensed User

    A solution for your task.
    • Wireless Socket, Bluetooth XAVAX 111970, 3500W,230V,Model HAMA-111970,Barcode 4047443271761, coverage up to 10m.(sold by in Germany for 10€).
  8. semar

    semar Active Member Licensed User

    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.
  9. thetahsk

    thetahsk Active Member Licensed User

  10. semar

    semar Active Member Licensed 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..
  11. thetahsk

    thetahsk Active Member Licensed 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.
  12. semar

    semar Active Member Licensed User

    I'm pulling my hear out by trying to find the option "Bluetooth capturing" on my Samsung Galaxy Alpha.. :confused:
    Never mind, I've found it !
    Last edited: Feb 7, 2019
  13. thetahsk

    thetahsk Active Member Licensed User

    And don't forget to disable the "Bluetooth capturing" after your work is done. Otherwise the size of the file converts to positive infinity.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice