Wrong file location! I thought you found the already existing in /var/lib/Repetier-Server/database/excommands.xml already. Server does only load that one.
oh wenn du deutsch kannst dann erklär nochmal deinen Satz auf deutsch xD Englisch ist nicht so meins. danke xD also wie geschrieben funktioniert das irgendwie nicht. und meiner Meinung nach ist ja alles richtig.
Der Pfad der Datei war falsch. Korrekter pfad ist /var/lib/Repetier-Server/database/excommands.xml - da liegt auch schon eine die du nur anpassen musst und dann server neu starten.
should work. Here firmware sleeps and @syncMotion waits for all commands in firmware to be executed. Without it would continue with next line. Drawback is that you can not control firmware any more.
Better would be to add the sleep command in TPLINKOFF script it self before it sends the link. If that is a bash script sleep 360 would then be the correct syntax.
should work. Here firmware sleeps and @syncMotion waits for all commands in firmware to be executed. Without it would continue with next line. Drawback is that you can not control firmware any more.
Better would be to add the sleep command in TPLINKOFF script it self before it sends the link. If that is a bash script sleep 360 would then be the correct syntax.
Just a side node - next release will natively support web requests as commands to e.g. call IFTTT maker webhooks to disable a plug. These commands will also be available in menus then. That makes it very easy to switch any plug with IFTTT support.
Thanks Any prediction of when the next release will be available?
Just a side node - next release will natively support web requests as commands to e.g. call IFTTT maker webhooks to disable a plug. These commands will also be available in menus then. That makes it very easy to switch any plug with IFTTT support.
Could you please tell me how can i make a smart plug (tp-link hs100) turns on/off with web actions through ifttt? Thanks in advance.
Url can be empty. But it can be any url to a image with matching size. So if you see a icon image you want to use just try it as link by copying image url (right click copy image url).
Right. So i found the script to this online (don't remember where anymore) so i am not taking any credit for that. But in essence with setting a few parameters with that script you can tell your switch to turn on or off. You then build it into repetier server either as a switch or to be triggered with an @execute command using the event dependant g-code settings.
So what you need to do is following:
1. Download the script ( i put it up on dropbox here: https://www.dropbox.com/s/00nt6lsma7mbf73/hs100B.sh?dl=0 ). Check the script as it has some instructions in it on how to use it. Basically you run it with passing 3 parameters and then it does its thing.
2. Copy the script onto your RPI or whatever you are running your repetier server on into a folder.
3. Open and edit your extcommands.xml file on your repetier server.
4. Add following line at the very end just before the </config>: <execute name="TPLINKOFF" allowParams="true">/pathtoyourscript/hs100B.sh ipofyourTPLinkswitch 9999 off</execute>
You can name your command whatever you want. I named mine TPLINKOFF as seen above.
5. In the repetier server webgui go to Printer Settings->G-Codes->Event Dependent and in the Run after job section add: @execute TPLINKOFF
Now whenever repetier server has finished your print it will trigger this script as entered with the parameters in the extcommands.xml file. So in this case it will tell the switch to turn itself off.
Now since i usually also make timelapses of my prints and repetier server does some compiling still even after the print is finished i personally also added a timer into the script to wait for 180 seconds after being activated before it turns off the switch. This gives repetier enough time to finish up the timelapse. If you want to do a similar delay then you need to edit the script. Open it up in notepad++ and search for the line: cmd_switch_off(){ I added command sleep 180 (this tells the script to wait for 180 seconds at this point before proceeding with the next command which is the actual command it sends to the TP LINK switch to turn itself off) which takes care of the delay.
And thats it.
Any chance someone has the script file, the links seems to be dead now.
You can now also just use the web actions to send http requests.
After reading the answer i must add that just disabling the pi with a switch is not best solution. You should always shut down the oi before unpowering or you risk a file imconsistency on the sd card. Will work most of the time but it might as well be in a bad state and start creating strange errors over time due to defect files or folders.
Right. So i found the script to this online (don't remember where anymore) so i am not taking any credit for that. But in essence with setting a few parameters with that script you can tell your switch to turn on or off. You then build it into repetier server either as a switch or to be triggered with an @execute command using the event dependant g-code settings.
So what you need to do is following:
1. Download the script ( i put it up on dropbox here: https://www.dropbox.com/s/00nt6lsma7mbf73/hs100B.sh?dl=0 ). Check the script as it has some instructions in it on how to use it. Basically you run it with passing 3 parameters and then it does its thing.
2. Copy the script onto your RPI or whatever you are running your repetier server on into a folder.
3. Open and edit your extcommands.xml file on your repetier server.
4. Add following line at the very end just before the </config>: <execute name="TPLINKOFF" allowParams="true">/pathtoyourscript/hs100B.sh ipofyourTPLinkswitch 9999 off</execute>
You can name your command whatever you want. I named mine TPLINKOFF as seen above.
5. In the repetier server webgui go to Printer Settings->G-Codes->Event Dependent and in the Run after job section add: @execute TPLINKOFF
Now whenever repetier server has finished your print it will trigger this script as entered with the parameters in the extcommands.xml file. So in this case it will tell the switch to turn itself off.
Now since i usually also make timelapses of my prints and repetier server does some compiling still even after the print is finished i personally also added a timer into the script to wait for 180 seconds after being activated before it turns off the switch. This gives repetier enough time to finish up the timelapse. If you want to do a similar delay then you need to edit the script. Open it up in notepad++ and search for the line: cmd_switch_off(){ I added command sleep 180 (this tells the script to wait for 180 seconds at this point before proceeding with the next command which is the actual command it sends to the TP LINK switch to turn itself off) which takes care of the delay.
And thats it.
Any chance someone has the script file, the links seems to be dead now.
#!/bin/bash
set -o errexit
(( "$DEBUG" )) && set -o xtrace
here=$(cd $(dirname $BASH_SOURCE[0]); echo $PWD)
##
# Switch the TP-LINK HS100 wlan smart plug on and off, query for status
# Tested with firmware 1.0.8
#
# Credits to Thomas Baust for the query/status/emeter commands
hi ich bin neu bei rs und würde gerne das script her zum laufen bekommen. die extcommands.xml hab ich schon bearbeitet und <execute name="TPLINKOFF" allowParams="true">/home/pi/script/hs100B.sh 192.168.178.45 9999 off</execute> am ende vor dem </config> eingetragen. meine vermutung warum es bei mir nicht geht das ich ein fehler in der hs100.sh habe. was muss ich wo in der hs100.sh eintragen? sorry für die dumme frage aber ich find es einfach nicht.
so also einen teilerfolg habe ich. über putty kann ich mit bash hs100.sh -i 192.168.178.45 off ausschalten und mit bash hs100.sh -i 192.168.178.45 on anschalten. das einzige was nicht will ist das mit dem @execute TPLINKOFF. in der extcommands.xml hab ich jetzt unten das drin <execute name="TPLINKOFF" allowParams="true">/home/pi/bash hs100.sh -i 192.168.178.45 off</execute> aber es will nicht über die rs konsole gehen.
hi ich bin neu bei rs und würde gerne das script her zum laufen bekommen. die extcommands.xml hab ich schon bearbeitet und <execute name="TPLINKOFF" allowParams="true">/home/pi/script/hs100B.sh 192.168.178.45 9999 off</execute> am ende vor dem </config> eingetragen. meine vermutung warum es bei mir nicht geht das ich ein fehler in der hs100.sh habe. was muss ich wo in der hs100.sh eintragen? sorry für die dumme frage aber ich find es einfach nicht.
so also einen teilerfolg habe ich. über putty kann ich mit bash hs100.sh -i 192.168.178.45 off ausschalten und mit bash hs100.sh -i 192.168.178.45 on anschalten. das einzige was nicht will ist das mit dem @execute TPLINKOFF. in der extcommands.xml hab ich jetzt unten das drin <execute name="TPLINKOFF" allowParams="true">/home/pi/bash hs100.sh -i 192.168.178.45 off</execute> aber es will nicht über die rs konsole gehen.
so ich hab meinen fehler gefunden. ich hab das bash falsch gesetzt gehabt nun gehts mit <execute name="TPLINKOFF" allowParams="true">bash /home/pi/hs100.sh -i 192.168.178.45 off</execute> geht es ohne probleme mit @execute TPLINKOFF. der weg ist das Ziel!
Comments
also wie geschrieben funktioniert das irgendwie nicht. und meiner Meinung nach ist ja alles richtig.
https://wiki.ubuntuusers.de/Shell/Bash-Skripting-Guide_f%C3%BCr_Anf%C3%A4nger/ Noch eine Erklärung dazu
Dann ging es auch mit meiner xml Datei ohne Probleme
sleep 360
is no valid gcode so nothing will happen.
G4 S360
@syncMotion
@execute TPLINKOFF
should work. Here firmware sleeps and @syncMotion waits for all commands in firmware to be executed. Without it would continue with next line. Drawback is that you can not control firmware any more.
Better would be to add the sleep command in TPLINKOFF script it self before it sends the link. If that is a bash script
sleep 360
would then be the correct syntax.
After reading the answer i must add that just disabling the pi with a switch is not best solution. You should always shut down the oi before unpowering or you risk a file imconsistency on the sd card. Will work most of the time but it might as well be in a bad state and start creating strange errors over time due to defect files or folders.
sorry für die dumme frage aber ich find es einfach nicht.
so also einen teilerfolg habe ich. über putty kann ich mit bash hs100.sh -i 192.168.178.45 off ausschalten und mit bash hs100.sh -i 192.168.178.45 on anschalten.
das einzige was nicht will ist das mit dem @execute TPLINKOFF.
in der extcommands.xml hab ich jetzt unten das drin <execute name="TPLINKOFF" allowParams="true">/home/pi/bash hs100.sh -i 192.168.178.45 off</execute> aber es will nicht über die rs konsole gehen.
<execute name="TPLINKOFF" allowParams="true">bash /home/pi/hs100.sh -i 192.168.178.45 off</execute>
geht es ohne probleme mit @execute TPLINKOFF.
der weg ist das Ziel!