From 7cddc997de0902198c28d95d6d46b2a9b6f936f0 Mon Sep 17 00:00:00 2001 From: EmberVR <117480158+Apple-VR@users.noreply.github.com> Date: Fri, 17 May 2024 01:02:41 -0500 Subject: [PATCH] Multi funtargets per pet Allow for multiple funtargets per pet --- script/pishockasync.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/script/pishockasync.py b/script/pishockasync.py index f32810d..5ac073d 100644 --- a/script/pishockasync.py +++ b/script/pishockasync.py @@ -200,9 +200,12 @@ async def loop(): if boolsend == 'True': sleeptime=funduration+1.1 print(f"sending {typesend} at {funintensity} for {funduration} seconds") - datajson = str({"Username":USERNAME,"Name":NAME,"Code":funtarget,"Intensity":funintensity,"Duration":funduration,"Apikey":APIKEY,"Op":funtype}) - headers = {'Content-type': 'application/json', 'Accept': 'text/plain'} - sendrequest=requests.post('https://do.pishock.com/api/apioperate', data=datajson, headers=headers) + + funtargets = funtarget.split(",") + for target in funtargets: + datajson = str({"Username":USERNAME,"Name":NAME,"Code":target,"Intensity":funintensity,"Duration":funduration,"Apikey":APIKEY,"Op":funtype}) + headers = {'Content-type': 'application/json', 'Accept': 'text/plain'} + sendrequest=requests.post('https://do.pishock.com/api/apioperate', data=datajson, headers=headers) print(f"waiting {sleeptime} before next command") #print(sendrequest)