Skip to content

Commit

Permalink
Add extra logging for starting up with previous state. #239
Browse files Browse the repository at this point in the history
  • Loading branch information
theyosh committed Feb 16, 2019
1 parent 2408e00 commit f7a339c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion terrariumEngine.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,9 @@ def __load_power_switches(self,data = None):

if power_switch_config['id'] in [None,'None',''] or power_switch_config['id'] not in self.power_switches:
# New switch (add)
if power_switch.get_id() in prev_state:
logger.info('Starting up switch {} with state {}'.format(power_switch_config['name'],prev_power_state))

power_switch = terrariumPowerSwitch(power_switch_config['id'],
power_switch_config['hardwaretype'],
power_switch_config['address'],
Expand All @@ -294,7 +297,8 @@ def __load_power_switches(self,data = None):
power_switch = self.power_switches[power_switch_config['id']]
power_switch.set_address(power_switch_config['address'])
power_switch.set_name(power_switch_config['name'])
if starting_up:
if power_switch.get_id() in prev_state:
logger.info('Starting up switch {} with state {}'.format(power_switch_config['name'],prev_power_state))
power_switch.set_state(prev_power_state)

power_switch.set_power_wattage(power_switch_config['power_wattage'])
Expand Down

0 comments on commit f7a339c

Please sign in to comment.