Skip to content

Commit

Permalink
Fix switch startup error
Browse files Browse the repository at this point in the history
  • Loading branch information
sebr committed Feb 20, 2020
1 parent 7b281d0 commit 0367e4a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions custom_components/bhyve/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,14 @@ def _set_watering_started(self, timestamp):
else:
self._attrs[ATTR_STARTED_WATERING_AT] = None

def _set_watering_program(self, watering_program):
if watering_program is None:
def _set_watering_program(self, program):
if program is None:
self._attrs[ATTR_WATERING_PROGRAM] = None
return

program_name = program.get("name", "Unknown")
program_id = program.get("program")
enabled = watering_program.get("enabled", False)
enabled = program.get("enabled", False)
if enabled is False:
_LOGGER.info(
"Watering program {} ({}) is not enabled, skipping".format(
Expand All @@ -133,7 +133,7 @@ def _set_watering_program(self, watering_program):
)
return

watering_plan = watering_program.get("watering_plan", [])
watering_plan = program.get("watering_plan", [])
upcoming_run_times = []
for plan in watering_plan:
run_times = plan.get("run_times")
Expand Down

0 comments on commit 0367e4a

Please sign in to comment.