Skip to content

Commit

Permalink
Update follow_me.py
Browse files Browse the repository at this point in the history
Tweak log output
  • Loading branch information
aneisch authored Dec 6, 2021
1 parent f866f56 commit bdf6c26
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions apps/follow_me/follow_me.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def initialize(self):
self.listen_state(self.state_change, entity)

# Defaults
self.delay = 0
self.delay = 5
self.invert = False
self.follow_on = True
self.follow_off = True
Expand Down Expand Up @@ -38,10 +38,10 @@ def state_change(self, entity, attribute, old, new, kwargs):

for device in self.split_device_list(self.args["follower"]):
if self.invert:
self.log(f"Turning off {device} in {self.delay} seconds")
self.log(f"Turning off {device}{f' in {self.delay} seconds' if self.delay > 0 else ''}")
self.run_in(self.turn_off(device), self.delay)
else:
self.log(f"Turning on {device} in {self.delay} seconds")
self.log(f"Turning on {device}{f' in {self.delay} seconds' if self.delay > 0 else ''}")
self.run_in(self.turn_on_handler, self.delay, entity_id=device)

elif new == "off" and old != "unavailable" and old != "Unavailable":
Expand All @@ -50,8 +50,8 @@ def state_change(self, entity, attribute, old, new, kwargs):

for device in self.split_device_list(self.args["follower"]):
if self.invert:
self.log(f"Turning on {device} in {self.delay} seconds")
self.log(f"Turning on {device}{f' in {self.delay} seconds' if self.delay > 0 else ''}")
self.run_in(self.turn_on(device), self.delay)
else:
self.log(f"Turning off {device} in {self.delay} seconds")
self.log(f"Turning off {device}{f' in {self.delay} seconds' if self.delay > 0 else ''}")
self.run_in(self.turn_off_handler, self.delay, entity_id=device)

0 comments on commit bdf6c26

Please sign in to comment.