From 4d428b2aa1eeeab0380db3c1bb835cefa3a0efd4 Mon Sep 17 00:00:00 2001 From: Romulus21 Date: Fri, 31 Oct 2025 22:39:05 +0100 Subject: [PATCH] test sendMessage --- Makefile | 4 ++-- octorpint-get-request.zip | Bin 1186 -> 0 bytes sendMessage.py | 29 +++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) delete mode 100644 octorpint-get-request.zip create mode 100644 sendMessage.py diff --git a/Makefile b/Makefile index 3b80d15..264c51f 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,3 @@ deploy: - zip -r octorpint-get-request.zip ./*.py - #scp ./*.py octoprint:/home/pi/.octoprint/plugins/get-request/ + #zip -r octorpint-get-request.zip ./*.py + scp sendMessage.py octoprint:/home/pi/.octoprint/plugins/ diff --git a/octorpint-get-request.zip b/octorpint-get-request.zip deleted file mode 100644 index 789be43fb5bfaebd5bfc3913f3477f8fe71aaa93..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1186 zcmWIWW@Zs#U|`^2cwa3Pz4Sy)y*d*E!x|O_25tr!hWPl*yv&mLc)fzk&=5`rW<%}8 z8S`Fj$|$YiW?*D_!OXzGq6pMn8*;GkvVp+f=h|%wQ$w`!wg#{hoiQDPTs@0-G z;-`I&tvtA~`K<`oqvjucbv(y2Z|UZmtKa_o=h@ja#XByl2As+cmtG>`5}En9L3hox ztkL(dzcwrFu16Iu`jDWj_?wn-*2SH_ZI(UGu1i zzB}gqIq#k)YrJmVtq%%K?faWwi))9x>slGJDAV%SW{nL`PB?0x+TrY+J6m<5#!mK< zlC#q;xLHdniCp)r@v>y$IwODduWelp3(Gymmahz2+osKW`u!8fy<-Z#iuZ($Z{Azf z-@zI1z=?DBk(vjJTHj;a-mg88$JHXR{#Ctw%Wm($OmKmIuGY43zM@#*u!-|w$^GWqoN z?d7)1FJJ6_dGlwA&CGpoep{f#I2rYgA5uSRS70V7GI2 zJ;USXAf+dz*PGS`q+k2}_RE^7VPbp#oLjTRVfv4*U+#@Z3=$_6$-a4%HCyK8%X>8y z&!;V$&X+Scb)QI__s)3-*X!n=b~B#)_;q%>0>fJs zy!kWbo%#IQJIi`MGC6JQxb$shz|m9B_WsV4tFpOwFf3zM=9Ux2MoNnByz;%{v{09n=@wojh6ZYX6Hp0G`$s7RW`<`n~#$JtG5y3oyNL z0MlA=YDsAUETO#xCNdC4OK80lHu^Ce^0a-g=F;YAxDt0d>ZJ->SO&X*bLiYl*WS9G zJ(~GQMBq{EjLP195}xa1oH#i33*VgomzyuM^})pERHe6$Tc^pCPh523yes3yo}7(B zmqjn1(L8+EJ;uys_sWy^rHwS$ByARa?($JxcdF3Rj`jMBaKFfNo$SnE?Q4xLY;Ud& zXn5wpr6|GD{=48$Ld$YLw!ZfZRCAKf{<2{#^lP`{oT|<#xkE9$v)ZV@{cV3n@7j=E zLNXuU#68}ev-Vig)yW547bI@0Gm^>`HBX$mX>o*cNrop6!?_1yGh=57ZgHACz171( z>45eFf$Iz}l_&0w+Ij1w?yoF84ZZBko4&rkefE>>kwwz3lIMe7Tg5u=jF}Vj<;{Kp zlQ(f$-W%_QueY4?CVI&mKOHrL_nT+_@Rrf~alEB=z3aDoY)4Z+at3%aGRZOH%I*@t zoXo%gj1h*njUX0E=4XXuezf>NHV`vTkqyiN#xf#?fu>=J-2iV^Hju?kKsX;rzXg^r G3=9A>)c&3T diff --git a/sendMessage.py b/sendMessage.py new file mode 100644 index 0000000..5e78af9 --- /dev/null +++ b/sendMessage.py @@ -0,0 +1,29 @@ +import octoprint.plugin + + +class SendMessagePlugin(octoprint.plugin.StartupPlugin): + def on_after_startup(self): + self._logger.info("Send Message plugin started!") + + def on_event(self, event, payload): + if event == "PrintDone": + self._logger.info("Print finished, sending webhook request...") + self.send_webhook(payload) + + def send_webhook(self, payload): + url = "https://smsapi.free-mobile.fr/sendmsg?user=58834922&pass=OgGZvJjNf5GCSU&to=0681952587&msg=Impression terminée" # Remplacez par l'URL réelle du webhook + try: + response = requests.get(url) + response.raise_for_status() + self._logger.info(f"Webhook sent successfully: {response.status_code}") + self._logger.info("payload") + self._logger.info(payload) + except requests.RequestException as e: + self._logger.error(f"Failed to send webhook: {e}") + + +__plugin_name__ = "Send Message" +__plugin_version__ = "1.0.0" +__plugin_description__ = "Send SMS on finish work" +__plugin_pythoncompat__ = ">=3.7,<4" +__plugin_implementation__ = SendMessagePlugin()