示例#1
0
    def get_last_seen(self):
        self._log("get_last_seen()")
        lights_dict_array = self.get_lights()
        factory = LifxFactory()
        lights = factory.create_bulb_collection(lights_dict_array)

        for light in lights:
            print light.id, light.seconds_since_seen()
            log_line = str(light.id) + ": " + str(light.last_seen) + ": " + str(light.seconds_since_seen())
            self._log(log_line)
示例#2
0
    def convert_response(self, response):
        response_text = response.text
        self._log("convert_response()")
        self._log(response.status_code)
        self._log(response_text)

        try:
            lights_dict_array = json.loads(response_text)
            factory = LifxFactory()
            return factory.create_bulb_collection(lights_dict_array)

        except Exception:
            self._log("convert_json throw exception")
            return {}