'Update the data for the sensor.'

def update(self):

    start = get_date(self._tz)
    end = get_date(self._tz, self.days)
    try:
        res = requests.get(ENDPOINTS[self.type].format(self.ssl, self.host, self.port, self.urlbase, start, end), headers={'X-Api-Key': self.apikey}, timeout=5)
    except OSError:
        _LOGGER.error('Host    %s    is    not    available', self.host)
        self._available = False
        self._state = None
        return
    if (res.status_code == 200):
        if (self.type in ['upcoming', 'movies', 'commands']):
            self.data = res.json()
            self._state = len(self.data)
        elif (self.type == 'diskspace'):
            if (self.included == []):
                self.data = res.json()
            else:
                self.data = list(filter((lambda x: (x['path'] in self.included)), res.json()))
            self._state = '{:.2f}'.format(to_unit(sum([data['freeSpace'] for data in self.data]), self._unit))
        elif (self.type == 'status'):
            self.data = res.json()
            self._state = self.data['version']
        self._available = True
