示例#1
0
 def update(self, **kwargs):
     """Update data."""
     import motorparts
     _LOGGER.info("updating vehicle data")
     try:
         self.vehicles = motorparts.get_summary(self._session)['vehicles']
     except motorparts.MoparError:
         _LOGGER.exception("failed to get summary")
         return
     for index, _ in enumerate(self.vehicles):
         try:
             self.vhrs[index] = motorparts.get_report(self._session, index)
             self.tow_guides[index] = motorparts.get_tow_guide(
                 self._session, index)
         except motorparts.MoparError:
             _LOGGER.warning("failed to update for vehicle index %s", index)
示例#2
0
 def update(self, **kwargs):
     """Update data."""
     import motorparts
     _LOGGER.info("Updating vehicle data")
     try:
         self.vehicles = motorparts.get_summary(self._session)['vehicles']
     except motorparts.MoparError:
         _LOGGER.exception("Failed to get summary")
         return
     for index, _ in enumerate(self.vehicles):
         try:
             self.vhrs[index] = motorparts.get_report(self._session, index)
             self.tow_guides[index] = motorparts.get_tow_guide(
                 self._session, index)
         except motorparts.MoparError:
             _LOGGER.warning("Failed to update for vehicle index %s", index)
示例#3
0
    def update(self, now, **kwargs):
        """Update data."""
        _LOGGER.debug("Updating vehicle data")
        try:
            self.vehicles = motorparts.get_summary(self._session)["vehicles"]
        except motorparts.MoparError:
            _LOGGER.exception("Failed to get summary")
            return

        for index, _ in enumerate(self.vehicles):
            try:
                self.vhrs[index] = motorparts.get_report(self._session, index)
                self.tow_guides[index] = motorparts.get_tow_guide(
                    self._session, index)
            except motorparts.MoparError:
                _LOGGER.warning("Failed to update for vehicle index %s", index)
                return

        dispatcher_send(self._hass, DATA_UPDATED)