diff --git a/server/power.py b/server/power.py index 8ed7a69..bddf530 100644 --- a/server/power.py +++ b/server/power.py @@ -19,6 +19,12 @@ def lights_on(): def lights_off(): np_02B_api(settings.LIGHT_IP, settings.LIGHT_USER, settings.LIGHT_PASS, False) +def grid_on(): + np_02B_api(settings.GRID_IP, settings.GRID_USER, settings.GRID_PASS, True) + +def grid_off(): + np_02B_api(settings.GRID_IP, settings.GRID_USER, settings.GRID_PASS, False) + if __name__ == '__main__': try: @@ -32,3 +38,15 @@ if __name__ == '__main__': lights_off() except BaseException as e: logging.error('Problem with lights: {} - {}'.format(e.__class__.__name__, str(e))) + + try: + print('Turning grid on...') + grid_on() + + print('Waiting three seconds...') + time.sleep(3) + + print('Turning grid off...') + grid_off() + except BaseException as e: + logging.error('Problem with grid: {} - {}'.format(e.__class__.__name__, str(e)))