Using ChastiKey API for seldbondage.

Selfbondage software and other kinky developments

Using ChastiKey API for seldbondage.

Postby anonuser » 08 Mar 2019, 00:31


May be many of you know about ChastiKey application for Android (see,
This application provides API for some form of automatization (

I just have wrote the script, which might control electromagnet lock by using ChastiKey application form one side, and WiFi smart socket from the other. Script communicate with ChastiKey server and turns on/off smart socket. Exact logic are following:

1) script starts and turns off the smart socket;
2) script communicates with server in cycle:
3) if you have no one active chastikey locks - nothing happens;
4) but if you have at least one active lock - script turn on the smart socket and remembers lock number (identifier);

5) script reprograms each minute smart socket and gives instruction to it, to automatically turn off after two minutes (so if script accidentally stops, if computer reboots, if WiFi network stops working - in all cases smart switch turns off after two minutes);

6) script still continues to poll chastikey server in cycle (once per minute):
7) if lock, which number already remembered, is reported to be unlocked - script turns of the smart socket;
8> if lock is deleted (in ChastiKey application, on the smartphone) - script does not unlocks you!

9) if communication with ChastiKey API server will be broken more for 5 minutes: script turns off smart socket;

10) if global timeout expired (4 hour by default) - script unlocks you unconditionally.

Currently script supports only two models of WiFi smart sockets: TP-Link HS-100 or HS-110.

Basically, setup is the following:

1) you are connect smart socket to the mains (wall socket);
2) to smart socket you are connecting any 12-V power adapter (from old laptop, from other electric compliance...)
3) power adapter powers the automotive relay (you can easily get it in local auto parts store);
4) relay disconnects the battery (PP3 9V battery, or pack of 6-8 AA-size batteries) from electromagnet lock.

This method is relatively safe, because if smart socket fails, battery drains in few hours or even minutes (depending on lock).

Second option: use regular timer in series with smart socket. Better to use mechanical timer, because two electronic timers might be affected by single fault reason (for example, overvoltage in mains). And then you can connect electromagnet lock directly to power adapter.
Personally I think this metod IS NOT RELIABLE, but option with batteris absolutely reliable.

Another option for safety is to use ice lock, then you don't need two timers in serios, or the batteries.

Please don't rely only on smart socket itself, always use second release option. Because smart socket might may hang by itself, script might contain bugs and give invalid commands to the socket, etc...

Script is attached to the message.

To start using the script you need download it. Then rename it from "chastikey.txt" to "".

Also if you computer doesn't have installed "Python", you should install it (I recommend "ActiveState Python").

Then you should open script in the editor (by using "notepad", "wordpad", or any other program) and edit it: at least you should set you "username" (line 19), as it configured in ChastiKey application on your smartphone.

Then you can run the script.
ChastiKay API for smart socket
(7.27 KiB) Downloaded 49 times
Posts: 1
Joined: 07 Sep 2010, 18:43

Return to Software

Who is online

Users browsing this forum: No registered users and 1 guest