Using ChastiKey API for seldbondage.

Selfbondage software and other kinky developments

Moderators: Riddle, Shannon SteelSlave

Post Reply
anonuser
*
Posts: 1
Joined: 07 Sep 2010, 20:43

Using ChastiKey API for seldbondage.

Post by anonuser »

Hello.

May be many of you know about ChastiKey application for Android (see chastikey.com, chastikeyforums.com).
This application provides API for some form of automatization (api.chastikey.com).

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 "chastikey.py".

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.
Attachments

[The extension txt has been deactivated and can no longer be displayed.]

User avatar
Shannon SteelSlave
Moderator
Posts: 6532
Joined: 03 Feb 2019, 19:49
Location: New England, USA

Re: Using ChastiKey API for seldbondage.

Post by Shannon SteelSlave »

I like your nods toward mechanical safety releases. I think this post might grab more response if it could be configured to desk top and lap top computers though, as many of our members continue to use them, ans will never get a smart phone. Looks like fun, though.
Bondage is like a foreign film without subtitles. Only through sharing and practice can we hope to understand.
A Jedi uses bondage for knowledge and defense, never for attack.
I am so smart! I am so smart! S-M-R-T!....I, I mean S-M-A-R-T!
👠👠
OneAndOnlyOdin
**
Posts: 109
Joined: 31 Mar 2019, 16:00

Removed

Post by OneAndOnlyOdin »

Removed
Last edited by OneAndOnlyOdin on 12 Jan 2022, 13:25, edited 1 time in total.
RIP Odin - Odin was killed to make place for other things. This forum will forever be a part of Odin's soul.
User avatar
sweh
***
Posts: 235
Joined: 10 Aug 2017, 01:14
Contact:

Re: Using ChastiKey API for seldbondage.

Post by sweh »

OneAndOnlyOdin wrote:Nice idea I see you have put in a lot of thought on how to make this as secure as possible. Also the code is close to professional level (from what I can tell of skimming through) I particularly like the use of Python there is a reason why the NASA relies on this for mission critical operations... Although I dont really understand how the electro magnet would be hard wired to a computer.
There are three parts to this solution:

* ChastiKey is a mobile app; interaction is performed from the mobile device. It provides an API so that status can be queried.

* A TP-Link smart plug. The electromagnet is connected to the smart plug.

* This software controls the smart plug. It does that by polling the ChastiKey API and sending the necessary on/off signals to the plug.

In theory it would be possible to use other plugs insiead of a TP Link one; eg something based off Sonoff using Tasmota (which has open API) but this solution uses an off-the-shelf plug and so is easier to build.
Post Reply