automatically start and stop lounge VM
This commit is contained in:
parent
0ecc843dd4
commit
3a31b82d2b
|
@ -57,6 +57,7 @@ def init_board_no_power_off(self):
|
||||||
setattr(pifacedigitalio.PiFaceDigital, 'init_board', init_board_no_power_off)
|
setattr(pifacedigitalio.PiFaceDigital, 'init_board', init_board_no_power_off)
|
||||||
|
|
||||||
def chch_status_output(pfd):
|
def chch_status_output(pfd):
|
||||||
|
# update status file
|
||||||
f = open("/tmp/status", 'w')
|
f = open("/tmp/status", 'w')
|
||||||
status = "geschlossen"
|
status = "geschlossen"
|
||||||
for i in range(button_count):
|
for i in range(button_count):
|
||||||
|
@ -68,6 +69,17 @@ def chch_status_output(pfd):
|
||||||
f.write(status)
|
f.write(status)
|
||||||
except OSError:
|
except OSError:
|
||||||
sys.stderr.write("Can not write to status file\n")
|
sys.stderr.write("Can not write to status file\n")
|
||||||
|
# start / stop lounge VM
|
||||||
|
if pfd.output_pins[0].value != 0:
|
||||||
|
try:
|
||||||
|
call(["/home/automation/proxmox-api-bash/vm_control.sh","chch","lounge","pve","310","start"])
|
||||||
|
except:
|
||||||
|
sys.stderr.write("Could not start lounge VM\n")
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
call(["/home/automation/proxmox-api-bash/vm_control.sh","chch","lounge","pve","310","shutdown"])
|
||||||
|
except:
|
||||||
|
sys.stderr.write("Could not start lounge VM\n")
|
||||||
|
|
||||||
def exec_chch_button_cmd(event):
|
def exec_chch_button_cmd(event):
|
||||||
c_pin = pin[event.pin_num]
|
c_pin = pin[event.pin_num]
|
||||||
|
|
Loading…
Reference in New Issue