code: def zone_schedules_backup(self, filename):
          
          _LOGGER.info("Backing up schedules from ControlSystem: %s (%s)...",
                       self.systemId, self.location.name)
  
          schedules = {}
  
          if self.hotwater:
              _LOGGER.info("Retrieving DHW schedule: %s...",
                           self.hotwater.zoneId)
  
              schedule = self.hotwater.schedule()
              schedules[self.hotwater.zoneId] = {
                  'name': 'Domestic Hot Water',
                  'schedule': schedule}
  
          for zone in self._zones:
              zone_id = zone.zoneId
              name = zone.name
  
              _LOGGER.info("Retrieving Zone schedule: %s - %s", zone_id, name)
  
              schedule = zone.schedule()
              schedules[zone_id] = {'name': name, 'schedule': schedule}
  
          schedule_db = json.dumps(schedules, indent=4)
  
          _LOGGER.info("Writing to backup file: %s...", filename)
          with open(filename, 'w') as file_output:
              file_output.write(schedule_db)
  
          _LOGGER.info("Backup completed.")
docs: Backup all zones on control system to the given file.