def __init__(self, **kwargs): self.time_init = utils.now() self.success = None self.classname = utils.classname(self) self.websocket_uri = "wss://bc.irisbylowes.com/websocket" self.db_locked = False self.db_refresh_required = False if not "account" in kwargs: raise exception.MissingConstructorParameter( classname=self.classname, parameter="account") if "place_name" in kwargs: self.place_name = kwargs["place_name"] else: raise exception.MissingConstructorParameter( classname=self.classname, parameter="place_name") self.debug = kwargs["debug"] if ( "debug" in kwargs and isinstance(kwargs["debug"], bool)) else False self.logger = utils.configure_logger(loggerid=self.classname, debug=self.debug) auth = authenticator.Authenticator(account=kwargs["account"], debug=self.debug) auth.authenticate() self.__init("irisAuthToken={}".format(auth.token))
def __init__(self, **kwargs): global cookie global token self.success = None self.places = {} self.ws_uri = "wss://bc.irisbylowes.com/websocket" if not "profile" in kwargs: raise exception.MissingConstructorParameter(parameter="profile") self.debug = kwargs["debug"] if ( "debug" in kwargs and isinstance(kwargs["debug"], bool)) else False self.logger = utils.configure_logger(debug=self.debug) auth = authenticator.Authenticator(profile=kwargs["profile"], debug=self.debug) auth.authenticate() token = auth.token cookie = "irisAuthToken={}".format(token) self.init() self.build_device_map() self.build_person_map() self.get_hub_id() #data = pkgutil.get_data("iris", "data/method-validator.json") #print(data) # This is a hack to get it to work until I can get python data to work pwd = os.path.dirname(os.path.realpath(__file__)) vp = "{}/data/method-validator.json".format(pwd) self.validator = json.loads(open(vp, "r").read())
def __init__(self, **kwargs): self.response = {} self.success = True self.token = None if "account" in kwargs: self.account = kwargs["account"] else: raise exception.MissingConstructorParameter(parameter="account") self.debug = kwargs["debug"] if ( "debug" in kwargs and isinstance(kwargs["debug"], bool)) else False self.logger = utils.configure_logger(debug=self.debug) self.authenticate()
def __init__(self, **kwargs): self.success = None self.response = {} if "iris" in kwargs: self.iris = kwargs["iris"] else: raise exception.MissingConstructorParameter(parameter="iris") if str(type(self.iris)) == "<class 'iris.core.Iris'>": self.ws = self.iris.ws self.logger = self.iris.logger else: raise exception.NotAnIrisCoreObject(class_name=str(type(self))) #def get_attributes(place_id=None, device_id=None, attribute=None):
def __init__(self, iris): self.success = True self.response = {} self.classname = utils.classname(self) self.response = {"status": "success", "message": "Empty message"} if not iris: raise exception.MissingConstructorParameter( classname=self.classname, parameter="iris") iris_type = utils.classname(iris) if iris_type == "iris.core.Iris": self.iris = iris self.websocket = self.iris.websocket self.logger = self.iris.logger self.debug = self.iris.debug self.websocket = self.iris.websocket self.event_ready = self.iris.event_ready else: raise exception.NotAnIrisCoreObject(classname=self.classname, got=iris_type)