def get_opening_type(zone):
 if ('MOTION' in zone['name']):
  return 'motion'
 if ('KEY' in zone['name']):
  return 'safety'
 if ('SMOKE' in zone['name']):
  return 'smoke'
 if ('WATER' in zone['name']):
  return 'water'
 return 'opening'

def get_opening_type ( zone ) : if ( 'MOTION' in zone [ 'name' ] ) : return 'motion' if ( 'KEY' in zone [ 'name' ] ) : return 'safety' if ( 'SMOKE' in zone [ 'name' ] ) : return 'smoke' if ( 'WATER' in zone [ 'name' ] ) : return 'water' return 'opening'
helper function to try to guess sensor type from name .