def update(self, car_id=None, wake_if_asleep=False, force=False):
cur_time = time.time()<EOL>with self.__lock:<EOL><INDENT>last_update = self._last_attempted_update_time<EOL>if (force or cur_time - last_update > self.update_interval):<EOL><INDENT>cars = self.get_vehicles()<EOL>for car in cars:<EOL><INDENT>self.car_online[car['<STR_LIT:id>']] = (car['<STR_LIT:state>'] == '<STR_LIT>')<EOL><DEDENT>self._last_attempted_update_time = cur_time<EOL><DEDENT>update_succeeded = False<EOL>for id_, value in self.car_online.items():<EOL><INDENT>if (car_id is not None and car_id != id_):<EOL><INDENT>continue<EOL><DEDENT>if (value and  <EOL>(id_ in self.__update and self.__update[id_]) and<EOL>(force or id_ not in self._last_update_time or<EOL>((cur_time - self._last_update_time[id_]) ><EOL>self.update_interval))):<EOL><INDENT>try:<EOL><INDENT>data = self.get(id_, '<STR_LIT:data>', wake_if_asleep)<EOL><DEDENT>except TeslaException:<EOL><INDENT>data = None<EOL><DEDENT>if data and data['<STR_LIT>']:<EOL><INDENT>response = data['<STR_LIT>']<EOL>self.__climate[car_id] = response['<STR_LIT>']<EOL>self.__charging[car_id] = response['<STR_LIT>']<EOL>self.__state[car_id] = response['<STR_LIT>']<EOL>self.__driving[car_id] = response['<STR_LIT>']<EOL>self.__gui[car_id] = response['<STR_LIT>']<EOL>self.car_online[car_id] = (response['<STR_LIT:state>']<EOL>== '<STR_LIT>')<EOL>self._last_update_time[car_id] = time.time()<EOL>update_succeeded = True<EOL><DEDENT><DEDENT><DEDENT>return update_succeeded<EOL><DEDENT>
Update all vehicle attributes in the cache.

        This command will connect to the Tesla API and first update the list of
        online vehicles assuming no attempt for at least the [update_interval].
        It will then update all the cached values for cars that are awake
        assuming no update has occurred for at least the [update_interval].

        Args:
        inst (Controller): The instance of a controller
        car_id (string): The vehicle to update. If None, all cars are updated.
        wake_if_asleep (bool): Keyword arg to force a vehicle awake. This is
                               processed by the wake_up decorator.
        force (bool): Keyword arg to force a vehicle update regardless of the
                      update_interval

        Returns:
        True if any update succeeded for any vehicle else false

        Throws:
        RetryLimitError