de en es fr
Let the machine help
Light teasing, exhibition, BDSM, sissyfication, watersports... with sounds and pictures


Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Openshock integration
PostPosted: Wed May 29, 2024 2:30 pm 
Offline
Shy
Here's a quick snippet to use SS to control an Openshock/shocklink shocker. CC-BY-SA-NC

Code:
//
// copy this into any script
//
//==================================================================
final send_post = { _host, _data, _token ->
   final post = new URL(_host).openConnection();
   post.setRequestMethod("POST")
   post.setDoOutput(true)
   post.setRequestProperty("Content-Type", "application/json")
   post.setRequestProperty("OpenShockToken", _token)
   post.getOutputStream().write(_data.getBytes("UTF-8"));
   final postRC = post.getResponseCode();
   if(postRC.equals(200)) {
      final text = post.getInputStream().getText("UTF-8")
      final jsonSlurper = new groovy.json.JsonSlurper()
      try {
         final object = jsonSlurper.parseText(text)
         return object
      } catch (Exception ex) {
         show(ex)
      }
   }
   else
   {
   show("Openshock error")
   wait(1)
   }
   return false
}

final send_shock = { _intensity, _duration ->
   def shocker_id = loadString("openshock.shocker_id")
   def token = loadString("openshock.token")
   //TODO check if id or token are valid
   
   def host = "hxxps-api-shocklink-net/2/shockers/control"
//   def data = "{\"shocks\":[{\"id\": \"$shocker_id\",\"type\": \"Vibrate\",\"intensity\": $_intensity,\"duration\": $_duration,\"exclusive\": true}],\"customName\": \"string\"}"
   def data = "{\"shocks\":[{\"id\": \"$shocker_id\",\"type\": \"Shock\",\"intensity\": $_intensity,\"duration\": $_duration,\"exclusive\": true}],\"customName\": \"string\"}"
   send_post(host, data, token)
}
//==================================================================
//



Code:
final set_token = { _token ->
   save("openshock.token", _token)
}

final set_shocker_id = { _id->
   save("openshock.shocker_id", _id)
}

final test = { ->
   send_shock(10,300)
}



def selection=0
while(selection != 3) {
   selection = getSelectedValue("Select option",["Set token", "Set id", "Test", "Exit"])
   if(selection==0) {
      set_token(getString("New value?", ""))
   }
   else if(selection==1) {
      set_shocker_id(getString("New value?", ""))
   }
   else if(selection==2){
      test()
   }
}


api url must be fixed because of forum limitations :P
Very bare bones and I haven't taken the effort to integrate it in scripts like Shock Yourself. Interested to see what this will lead to.


Top
 Profile Send private message 
 
 Re: Openshock integration
PostPosted: Sun Jun 02, 2024 4:37 pm 
Offline
Addict
Thanks for sharing! I'd never seen Openshock before. It looks very interesting! :D

It appears that you have some experience with it. I did a quick browse of the site. Could you give a quick intro of its real possibilities?

_________________
Just here for laughs ... and grimaces. ;)


Top
 Profile Send private message 
 
 Re: Openshock integration
PostPosted: Mon Jun 03, 2024 5:07 pm 
Offline
Shy
OpenShock allows off-the-shelf wireless shockers to be controlled over the internet. Instead of using the remote of the shocker, a signal is sent by a microcontroller. (Very similar to PiShock.) This means that someone else could control the shocker over the internet (or like here, some process via the API). For the shocker I have (and maybe for all types. idk), sound and vibration signals are also exposed. Shock intensity goes from 1-99 & I don't see myself maxxing that out any time soon. I used to drive my shocker via MQTT but even if I would go back to selfhosting I would probably set up a personal instance of OpenShock instead.
Honestly, because the API is so accessible, the possibilities are endless. Hooking into existing services can be a bit tough but it should be very easy to write a webapp that integrates with OpenShock. For example a line writing app. I believe mods for Minecraft and Lethal Company already exist.
As for limitations, the OpenShock team has done a great job at implementing a live mode, I didn't pull that off with my hacky MQTT solution. Secondly, because of the RF protocol, there is no way to detect if the shocker received the signal. Range is more than good enough, but from a bratting perspective I'm looking for a low-tech solution to lock the shocker onto the sub & prevent turning the shocker off.


Top
 Profile Send private message 
 
 Re: Openshock integration
PostPosted: Sat Jun 15, 2024 12:23 am 
Offline
Addict
It looks like there is an opportunity for all kinds of fun with this. :shock: :lol:

Do you have a recommendation for an inexpensive collar / receiver that you know works well with this?

Thanks!

_________________
Just here for laughs ... and grimaces. ;)


Top
 Profile Send private message 
 
 Re: Openshock integration
PostPosted: Sat Jun 22, 2024 9:43 am 
Offline
Site Admin
User avatar
It looks good

Notice: there's a JSON parser/formater in SexScripts, this one : https://docs.groovy-lang.org/latest/htm ... guide.html


Top
 Profile Send private message 
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Maroon Fusion theme created by Oxydo
Software, theme modifications, phpBB modification by Doti 2010 - 2020
This website uses session cookies only.