Wondering if someone can help me out. I’m new to AppDaemon, and python. I’ve created a few automations based on time and sensors, and they are all working fine. I created one based on my presence, and it was working fine yesterday. For some reason, at 3:00am, it decided my state changed and ran the automation. I turned everything off, and after a few minutes it happened again.
I checked the status of my device tracker, and the status hadn’t changed since I arrived home hours before. I’ve pasted my code and what’s listed in my apps.yaml file below.
class Presence(hass.Hass):
def initialize(self):
self.listen_state(self.state_change, self.args["tracker"])
def state_change(self, entity, attribute, new, old, kwargs):
dave = self.get_tracker_state(self.args["tracker"])
if dave == "home":
self.arrive_home()
else:
#dave == "not_home":
self.leave_home()
def arrive_home(self):
self.turn_on(self.args["script_unlock"])
self.turn_on(self.args["scene_on1"])
self.turn_on(self.args["scene_on2"])
def leave_home(self):
self.turn_on(self.args["script_lock"])
self.turn_on(self.args["scene_off1"])
self.turn_on(self.args["scene_off2"])
dave_presence:
module: presence
class: Presence
script_unlock: script.1517501901267
script_lock: script.1517500849790
tracker: device_tracker.dave_s8
scene_on1: scene.living_room_lights_100
scene_on2: scene.kitchen_ceiling_lights_100
scene_off1: scene.interior_lights_off
scene_off2: scene.remotes_off