'Parse humidity sensor value.'

@staticmethod
def _update_hum_sensor(state):

    unit = state.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
    hum = util.convert(state.state, float)
    if (hum is None):
        _LOGGER.error('Unable    to    parse    sensor    humidity:    %s', state.state)
        return None
    if (unit != '%'):
        _LOGGER.error('Humidity    sensor    has    unsupported    unit:    %s    %s', unit, '    (allowed:    %)')
    if ((hum > 100) or (hum < 0)):
        _LOGGER.error('Humidity    sensor    out    of    range:    %s    %s', hum, '    (allowed:    0-100%)')
    return hum
