Execute Batch file on remote PC

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
Thomasdc
Posts: 133
Joined: Wednesday 11 March 2015 19:13
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Execute Batch file on remote PC

Post by Thomasdc »

Hi everybody!

I run Domoticz on a Raspberry pi

I wondered if it was possible to execute a Batch file on a windows 10 pc with domoticz on the Raspberry pi
(i saw that it was possible to shut down a pc remotly, so i was hoping that maybe executing a batch file on a remote pc would also be possible)

the way i see it there are 2 "scenario's"
1) The code is in a batch file on the pc and the Rpi with domoticz on it send a command to the pc to execute the batch file

2) The code is sent from the Rpi to the Remote PC (some kind of SSH connection? )

I don't know if any of those 2 are possible, but it would help me a lot!


Thanks!
Raspberry Piet
Posts: 158
Joined: Saturday 11 January 2014 16:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: NL
Contact:

Re: Execute Batch file on remote PC

Post by Raspberry Piet »

Hi Thomas,

That would be possible by using scenario nr 1.

I use Evenghost with AutoRemote plugin to achieve this.
But i'm sure there is also another plugin for Eventghost that could do the same.
User avatar
bizziebis
Posts: 182
Joined: Saturday 19 October 2013 14:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8805
Location: The Netherlands
Contact:

Re: Execute Batch file on remote PC

Post by bizziebis »

You can also install Domoticz on your Windows PC and connect both Domoticz to each other :)
Thomasdc
Posts: 133
Joined: Wednesday 11 March 2015 19:13
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: Execute Batch file on remote PC

Post by Thomasdc »

Raspberry Piet wrote:Hi Thomas,

That would be possible by using scenario nr 1.

I use Evenghost with AutoRemote plugin to achieve this.
But i'm sure there is also another plugin for Eventghost that could do the same.

Thanks!
has anyone experience with this but with Domoticz instead of tasker?



bizziebis wrote:You can also install Domoticz on your Windows PC and connect both Domoticz to each other :)

i thought of this also but i rather not instal domoticz for something simple like executing some code once maybe twice a day.

mostly i would like a "scenario 2" manner to do this, this way i can program all the code on 1 place (the RPI) and if i ever replace my computers it all keeps working with little modification (permissions settings or something )
Raspberry Piet
Posts: 158
Joined: Saturday 11 January 2014 16:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: NL
Contact:

Re: Execute Batch file on remote PC

Post by Raspberry Piet »

Thomasdc wrote:
Raspberry Piet wrote:Hi Thomas,

That would be possible by using scenario nr 1.

I use Evenghost with AutoRemote plugin to achieve this.
But i'm sure there is also another plugin for Eventghost that could do the same.

Thanks!
has anyone experience with this but with Domoticz instead of tasker?
I use it with the AutoRemote plugin like this:
RPI CLI:

Code: Select all

curl -m 1 "http://192.168.1.10:1817/?message=ARPAR=:=ARCOMM"
Evenghost:
Image

Then add macro:
Image
Image
Thomasdc
Posts: 133
Joined: Wednesday 11 March 2015 19:13
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: Execute Batch file on remote PC

Post by Thomasdc »

This works great!!! so easy to use! the possibilities are amazing!

Big thanks for this suggestion Raspberry Piet!
Raspberry Piet
Posts: 158
Joined: Saturday 11 January 2014 16:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: NL
Contact:

Re: Execute Batch file on remote PC

Post by Raspberry Piet »

Thomasdc wrote:This works great!!! so easy to use! the possibilities are amazing!

Big thanks for this suggestion Raspberry Piet!
Yes, Eventghost is amazing. (it's like a sort of Tasker for Windows) ;)
Many useful plugins available also!
AutoRemote is my favorite. Works with EventGhost, Tasker and Linux here.

Here is my simple AutoRemote bash script i use to send messages to EventGhost and my android smartphone:
Spoiler: show

Code: Select all

#!/bin/sh
ARPAR=$1  # %arpar(): array with all the parameters at the left of =:=
ARCOMM=$2  # %arcomm: all the words at the right of =:= (if only one =:= is present)
TTL=$3 # Time in seconds AutoRemote will try to deliver the message for before giving up
################################################
# Settings 
KEY="xxxxxx" #SMARTPHONE
EG_IP="192.168.1.10"
EG_PORT="1817"
 ################################################
# SEND AUTOREMOTE MESSAGE TO SMARTPHONE (WAN)
string="https://autoremotejoaomgcd.appspot.com/sendmessage?key=$KEY&message=$ARPAR=:=$ARCOMM&ttl=$TTL"
string2=$( printf "%s\n" "$string" | sed 's/ /%20/g' )
echo $string2
curl "$string2"
#################################################
# SEND AUTOREMOTE MESSAGE TO EVENTGHOST (LAN)
string="http://$EG_IP:$EG_PORT/?message=$ARPAR=:=$ARCOMM"
string2=$( printf "%s\n" "$string" | sed 's/ /%20/g' )
echo $string2
curl -m 1 "$string2"
Example:

Code: Select all

/home/pi/domoticz/scripts/bash/AutoRemote.sh "CMD" "DOORBELL" "10"
Sends this message to EvenGhost (which executes VLC opening ipcam stream), ...
endless possibilities! :ugeek:
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest