You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When setting up CheckPresenceOnPing, it keeps reenabling the security zones, when nobody is at home (no device is reachable).
This can be problematic, as this causes a popup on every configured client and also spams the alarm log.
Expected behaviour would be that on 'noone is home' and already activated security zone, nothing is done.
The text was updated successfully, but these errors were encountered:
Well, without actually knowing what I am doing - this does it for me, AFAICT. Straightened the outputs a little and added a timestamp in front for easier logging.
#!/usr/bin/env python3importhomematicipfromhomematicip.homeimportHomeimportping3fromsocketimportgaierrorimportdatetimeconfig=homematicip.find_and_load_config_file()
SCANABLE_DEVICES= ['192.168.128.101', '192.168.128.108']
ACTIVATE_EXTERNAL_ZONE=TrueACTIVATE_INTERNAL_ZONE=FalseDEACTIVATE_ON_PRESENCE=Truedefmain():
ifconfigisNone:
print("{} COULD NOT DETECT CONFIG FILE")
returnhome=Home()
home.set_auth_token(config.auth_token)
home.init(config.access_point)
ifnothome.get_current_state():
returnforipinSCANABLE_DEVICES:
try:
res=ping3.ping(ip)
ifres!=None:
ifDEACTIVATE_ON_PRESENCE:
forginhome.groups:
ifisinstance(g, homematicip.group.SecurityZoneGroup) andg.active:
print("{} Someone is at home, security zones are active -> deactivating security zones.".format(datetime.datetime.now().strftime("%y%m%d-%H:%M")))
home.set_security_zones_activation(False,False)
returnprint("{} Someone is at home, security zones are deavtivated -> do nothing.".format(datetime.datetime.now().strftime("%y%m%d-%H:%M")))
else:
print("{} Someone is at home, security zones are inactive -> do nothing.".format(datetime.datetime.now().strftime("%y%m%d-%H:%M")))
returnexceptgaierror:
print("Could not resolve {}. Marking it as \"not at home\"".format(ip))
forginhome.groups:
ifisinstance(g, homematicip.group.SecurityZoneGroup) andg.active:
print("{} Nobody is at home, security zones are already active -> do nothing.".format(datetime.datetime.now().strftime("%y%m%d-%H:%M")))
returnprint("{} Nobody is at home, security zones are inactive -> activating security zones.".format(datetime.datetime.now().strftime("%y%m%d-%H:%M")))
home.set_security_zones_activation(ACTIVATE_INTERNAL_ZONE,ACTIVATE_EXTERNAL_ZONE)
if__name__=="__main__":
main()
When setting up CheckPresenceOnPing, it keeps reenabling the security zones, when nobody is at home (no device is reachable).
This can be problematic, as this causes a popup on every configured client and also spams the alarm log.
Expected behaviour would be that on 'noone is home' and already activated security zone, nothing is done.
The text was updated successfully, but these errors were encountered: