Since I got my RetroPie setup with a HS100 plug from TP-Link I want to do the following with a dummy switch:
On: switch the HS100 on (and RetroPie will boot automatically).
Off: remote shutdown RetroPie and when it is off, switch off the HS100.
The problem is the remote shutdown.
I know how to log in with Putty and send the shutdown command, however, I do not know how to write a script to have my Domoticz Raspberry pi ogin and shut it down and what additional packages might be needed for that.
Can some-one please tell me how this should be done?
Thanks,
Freek
Remote shutdown Retropie via Domoticz
Moderators: leecollings, remb0
-
nosehook
- Posts: 49
- Joined: Thursday 31 March 2016 20:49
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Remote shutdown Retropie via Domoticz
Pi3 Domoticz | RFXcom 433E | KAKU/COCO |Harmony Hub | Samsung TV | HS100 | HS110| HUE | Tradfri | Tado| Xiaomi |sensors | scripts| Pi3 Node Red | Pi2 SDS_011 + MH-Z19B | PiAware (zero) | Pi2 breadboard with Node red and Domoticz
- emme
- Posts: 909
- Joined: Monday 27 June 2016 11:02
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest
- Location: Milano, Italy
- Contact:
Re: Remote shutdown Retropie via Domoticz
you can try a remote ssh session with no password and issue the shutdown command
have a look to this site about how to connect via ssh and with no password
http://www.linuxproblem.org/art_9.html
have a look to this site about how to connect via ssh and with no password
http://www.linuxproblem.org/art_9.html
The most dangerous phrase in any language is:
"We always done this way"
"We always done this way"
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Remote shutdown Retropie via Domoticz
Isn't there a auto shutdown option in retropie?
Otherwise I have a script that detects when a network device is offline and switches it's power off. I use it for a Libreelec-Pi.
Otherwise I have a script that detects when a network device is offline and switches it's power off. I use it for a Libreelec-Pi.
-
nosehook
- Posts: 49
- Joined: Thursday 31 March 2016 20:49
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Remote shutdown Retropie via Domoticz
If there is an auto shutdown I can not find it...Egregius wrote:Isn't there a auto shutdown option in retropie?
Otherwise I have a script that detects when a network device is offline and switches it's power off. I use it for a Libreelec-Pi.
Could you share your script please?
Pi3 Domoticz | RFXcom 433E | KAKU/COCO |Harmony Hub | Samsung TV | HS100 | HS110| HUE | Tradfri | Tado| Xiaomi |sensors | scripts| Pi3 Node Red | Pi2 SDS_011 + MH-Z19B | PiAware (zero) | Pi2 breadboard with Node red and Domoticz
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Remote shutdown Retropie via Domoticz
Sure, part of my pass2php script:
If my Kodi isn't listening anymore, for 5 runs I shutdown it's power.
The 5 runs is in there to enable updates of Libreelec, otherwise power is killed during update... Can't be good.
Code: Select all
if($s['kodi']=='On'&&strtotime($t['kodi'])<time-298)
{
$devcheck='Kodi';
if(pingDomain('192.168.2.7',1597)==1)
{
$prevcheck=cget('check'.$devcheck);
if($prevcheck>0)
cset('check'.$devcheck,0);
}
else
{
$check=cget('check'.$devcheck)+1;
if($check>0)
cset('check'.$devcheck,$check);
if($check>=5)
sw($i['kodi'],'Off','kodi');
}
}
function pingDomain($domain,$port)
{
$file=fsockopen($domain,$port,$errno,$errstr,10);
$status=0;
if(!$file)
$status=-1;
else
{
fclose($file);
$status=1;
}
return $status;
}
The 5 runs is in there to enable updates of Libreelec, otherwise power is killed during update... Can't be good.
Who is online
Users browsing this forum: No registered users and 1 guest